Arguments and Schemas
The schema passed to defineTask validates and transforms ctx.args before your run body and each defined callback. Invalid inputs throw an Invalid task arguments: ... error before user logic runs. Async refinements and transforms are supported by the SDK's asynchronous parse.
import { defineTask, z } from '@thyme-labs/sdk'
export default defineTask({
schema: z.object({
targetAddress: z.address(),
amount: z.string().regex(/^[0-9]+$/),
}),
async run(ctx) {
const amount = BigInt(ctx.args.amount)
ctx.logger.info(`Requested ${amount} at ${ctx.args.targetAddress}`)
return { canExec: false, message: 'Inputs validated' }
},
})Use JSON-compatible input values. An amount beyond JavaScript's safe integer range should be a decimal string; parse it inside the task, or use an appropriate coercing schema. A raw z.bigint() does not accept a JSON string automatically.
Input sources
| Invocation | Source |
|---|---|
| Local | functions/<task>/args.json. |
| Scheduled or manual cloud run | Args stored on the executable. |
Empty webhook request or {} | Snapshot of predefined executable args. |
| Non-empty webhook object | Complete replacement for that invocation. |
Local args are not uploaded as the executable's configuration. Set cloud args when creating the executable or update them through its settings, CLI, or API.
Console form and webhook validation
Upload extracts a JSON Schema used by the console's Fields editor and webhook request validation. JSON mode lets you edit the whole object. JSON Schema is a structural description; arbitrary Zod refinements and transforms cannot all be expressed in it. Runtime SDK validation remains authoritative for task execution.
Webhook validation happens before execution creation. It does not coerce values or inject defaults, and non-empty custom args are not merged with predefined args. A function without an uploaded schema accepts only empty/predefined webhook requests.
Address arguments and permissions
z.address() validates an Ethereum address and returns its checksummed form. See the schema reference for exact semantics.
A permission manifest can use a top-level argument as its target address. Changing that arg causes Flow to recheck the selected profile's scope; it may require an owner-approved permission update before the executable can run.
During a staged function switch, args and code commit together, so concurrent args edits are blocked. See release management.