handler runs your own function in place of the model — for math, lookups, or calling existing code.
Quick Start
1
Run a function instead of the model
2
Read the workflow context
What the Handler Receives
The handler is called with one object.What the Handler Returns
Return a string, or an object for more control.Publish variables for later prompts
Variables a handler publishes fill{{placeholder}} slots in later tasks.
A handler that returns a plain string publishes nothing —
{{topic}} stays unfilled. Return { output, variables } to publish.Stop the workflow
A throwing handler fails only its task
How It Works
Best Practices
Use handlers for deterministic work
Use handlers for deterministic work
Math, database lookups, and API calls belong in a handler, not a prompt.
Publish variables to steer later prompts
Publish variables to steer later prompts
Return
{ output, variables } so downstream {{placeholder}} slots fill in.Fail loudly, stop deliberately
Fail loudly, stop deliberately
Throw to fail one task; return
{ stopWorkflow: true } to end the whole run.Related
Tasks
All task options
Routing
Branch between tasks

