Skip to main content
A task 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

Math, database lookups, and API calls belong in a handler, not a prompt.
Return { output, variables } so downstream {{placeholder}} slots fill in.
Throw to fail one task; return { stopWorkflow: true } to end the whole run.

Tasks

All task options

Routing

Branch between tasks