WorkflowsPatterns
WORKFLOWS

Patterns

Keep workflow handoffs small, explicit, and observable.

Start with a short sequence whose intermediate outputs have a clear purpose.

Use workflows when routing matters

A single agent with tools may be enough. Choose a flow when the application must prescribe the next agent and the failure path.

Define the handoff

Write instructions for the input each step actually receives. The next agent gets the last successful output, not a shared collection of every prior result.

The guide's review agent can improve a summary's clarity. Checking its accuracy against the original source requires supplying that source too.

Keep business actions in services

Keep validation and data changes in application services called by tools. A failure transition does not roll back earlier calls. Design retries and side effects together.

Inspect step outcomes

A recovered flow can contain failures even when its final status is Completed. Inspect visited steps when diagnosing execution.

Full traces can contain user inputs, outputs, and service errors. Return only the fields a product caller needs.

Keep registrations clear

Use stable IDs, distinct agent CLR types, and explicit success targets. Review success and failure paths when changing definitions.

See Running workflows and Failure handling.

On this page