What are Workflows?
Workflows are powerful multi-step operations that enable your agent to handle complex, long-running tasks that require user interaction, external API calls, or sequential processing. Unlike simple tool calls that execute instantly, workflows can pause execution to wait for user input, show progress updates, and resume from where they left off. This makes them perfect for scenarios like multi-step onboarding processes, complex data analysis pipelines, interactive tutorials, or any task that requires back-and-forth communication with users. Workflows are built using generator functions that can yield status updates and pause for input, making them ideal for creating engaging, interactive agent experiences.Workflow Execution
Workflows are automatically triggered when your AI agent decides to use them during conversations. You don’t manually call workflows; instead, you ask your agent to do something (like “help me swap tokens” or “guide me through onboarding”), and the agent intelligently chooses to use a workflow tool when appropriate. The workflow then executes in the background, can pause for your input, and returns results to continue the conversation.Create Custom Workflows
1
Create Your Workflow File
Note that the
config/
folder and example workflow file are created when you run pnpm cli init
, and they don’t exist in the initial repository. For more detailed guidelines, check out the GitHub repository.config/workflows/
. There is an example config/workflows/example-workflow.ts
file provided for reference. The example workflow demonstrates progress updates, user interaction, and multi-step execution:2
Register Your Workflow
To register your workflow, add it to Next, add it to
config/workflow.json
. This step makes your workflow discoverable by the agent system:config/agent.manifest.json
. This step enables the workflow for your agent:3
Test Your Workflow
dispatch_workflow_{workflow_id}
(e.g., dispatch_workflow_my_workflow
).