Subchapter 1.19
references/workflows.mdMarkdown2 KBView on GitHub
Use Agents for interactive communication and state management. Add a Workflow when a task needs durable multi-step execution, independent retries, or waits for external approval. Choose based on recovery needs; consult Run Workflows before implementing the integration.
| Task | Documentation |
|---|---|
Define a typed AgentWorkflow, start it from an Agent, and configure bindings | Quick start (opens in a new tab) |
| Call back into the originating Agent and understand durable versus non-durable helpers | AgentWorkflow class (opens in a new tab) |
| Send events, query instances, pause, resume, terminate, or delete tracked workflows | Agent workflow methods (opens in a new tab) |
| Receive progress, completion, errors, and custom events | Lifecycle callbacks (opens in a new tab) |
| Approve or reject a waiting task | Human-in-the-loop approval (opens in a new tab) |
| Persist Workflow results into Agent state | State synchronization (opens in a new tab) |
| Define steps, parameters, retries, and returned values | Workers API (opens in a new tab) |
Keep external side effects within durable steps, make retried operations idempotent, and persist the values needed after recovery through step results. Use the Rules of Workflows (opens in a new tab) to choose step boundaries.
Progress reports and client broadcasts may repeat on retry. Use the documented durable step helpers for persistent Agent state changes and completion reporting; see bidirectional communication (opens in a new tab).