- Agent —
agentprovided; children become the prompt. - Compute — children is a function, no
agent; function is called at execution time. - Static — children is a plain value, no
agent; value is written directly as output.
<Task needsApproval> pauses before execution. For explicit decision nodes, use <Approval>.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | (required) | Stable node identity. Must be unique within the workflow. |
output | z.ZodObject | Table | string | (required) | Output destination. Zod schema from outputs (recommended), Drizzle table, or string key. |
outputSchema | z.ZodObject | undefined | Expected agent output structure. Inferred when output is a Zod schema. When provided with a React element child, a schema prop containing a JSON example is auto-injected. |
agent | AgentLike | AgentLike[] | undefined | AI SDK agent or ordered array [primary, fallback1, ...]. Agents are tried in order on retries. |
fallbackAgent | AgentLike | undefined | Single retry fallback agent. Appended to the agent chain. |
dependsOn | string[] | undefined | Explicit dependency on other task IDs. Task waits until all complete. |
needs | Record<string, string> | undefined | Named dependencies. Keys become context keys, values are task IDs. |
deps | Record<string, OutputTarget> | undefined | Typed render-time dependencies. Each key resolves from the task with the same id, or from a matching needs entry. |
key | string | undefined | Standard React key. No effect on execution. |
skipIf | boolean | false | Skip this task. |
needsApproval | boolean | false | Pause and wait for approval before executing. |
timeoutMs | number | undefined | Max execution time in ms. Task fails on timeout. |
retries | number | 0 | Retry attempts on failure. |
retryPolicy | RetryPolicy | undefined | { backoff?: "fixed" | "linear" | "exponential", initialDelayMs?: number } |
continueOnFail | boolean | false | Workflow continues even if this task fails. |
cache | CachePolicy | undefined | { by?: (ctx) => unknown, version?: string }. Skip re-execution when a cached result with matching key/version exists. |
label | string | undefined | Human-readable label for UI and metadata. |
meta | Record<string, unknown> | undefined | Arbitrary metadata on the task descriptor. |
scorers | ScorersMap | undefined | Map of scorer configs to evaluate task output after execution. See Evals & Scorers. |
children | string | Row | (() => Row | Promise<Row>) | ReactNode | ((deps) => Row | ReactNode) | (required) | Agent mode: prompt text or JSX rendered to markdown. Compute mode: callback. Static mode: output value. With deps, a render function receiving typed upstream outputs. |
Agent mode
Typed deps
deps with needs:
Structured output with outputSchema
WhenoutputSchema is provided and children are a React element, a schema prop containing a JSON example is auto-injected. The MDX template can reference {props.schema}.
Compute mode
Children is a function, noagent. Called at execution time; return value becomes output. Sync or async.
continueOnFail behavior.
Static mode
Noagent, children is not a function. Value is written directly as output. deps works in static mode.
Output resolution
Theoutput prop accepts three forms:
Zod schema from outputs (recommended) — type-checked at compile time; resolved to the correct table via zodToKeyName.
getTableName() to determine storage.
Full example
Schema-driven (recommended)
Custom Drizzle table output (advanced)
createSmithers(...) as usual.
Error handling
| Scenario | Behavior |
|---|---|
Duplicate id | Throws "Duplicate Task id detected: <id>" at render time. |
Missing output | Throws "Task <id> is missing output table." at render time. |
| Agent timeout | Fails after timeoutMs. Retries if retries > 0. |
| Agent failure | Fails. Retries if retries > 0. Continues if continueOnFail. |
| Callback throws | Same retry/continueOnFail behavior as agent failures. |
| Callback timeout | Fails after timeoutMs. Retries if retries > 0. |
Notes
- Custom Drizzle tables must include
runIdandnodeIdcolumns. Tasks inside<Loop>additionally neediteration.createSmithers(...)adds these automatically. idis thenodeIdin the task descriptor; uniqueness is enforced at render time.- In agent mode, JSX/MDX children are rendered to markdown (not HTML) before being sent to the agent.