Back to notes
Apply this to a build
AgentsGuide6 min
Design agent handoffs for specialized workflows
A practical way to split complex AI workflows into specialized agents without making the product unpredictable.
Open source docReal workflow example
A single prompt tries to read a tender, decide fit, draft a proposal outline, and check compliance. It becomes hard to debug when the final output is wrong.
Use specialized steps: extraction creates facts, qualification scores fit, drafting writes sections, verification checks required documents and claims. Each step passes structured data to the next.
The team can see which step failed and improve that part without rewriting the entire workflow.
Implementation approach
This guide is anchored in OpenAI tools guide. Use the official API behavior as the boundary, then design the surrounding product state so the feature can be reviewed, retried, and improved.
- Split the workflow by responsibility, such as classify, retrieve, draft, verify, and escalate.
- Define what each step receives and what it must return before the next step runs.
- Keep shared memory small and pass structured summaries instead of raw conversation history.
- Add stop conditions for missing data, low confidence, and unsafe requests.
- Show the handoff trail in logs or an operator-facing timeline.
Code or config snippet when useful
type agent_handoffs_specialized_workflows_workflow_state = {
sourceId: string;
status: "draft" | "needs_review" | "approved" | "blocked";
evidence: Array<{ source: string; summary: string }>;
nextAction: string;
};
Field notes
- A handoff is a product contract, not just a prompt instruction.
- Specialized agents need clear ownership, inputs, outputs, and stop conditions.
- Users should be able to tell which step produced a recommendation.
Mistakes to avoid
- Do not create agents without distinct responsibilities.
- Do not pass full raw context through every handoff.
- Do not let later steps overwrite earlier factual extraction without review.
Ready checklist
- Agent responsibilities are distinct
- Structured handoff payloads
- Stop conditions exist
- Shared context minimized
- Handoff timeline visible
