Skip to main content
Schema-validated handoffs ensure data integrity between agents using Pydantic models, raising validation errors immediately instead of producing incorrect LLM output.
The user receives polished content; the researcher hands off a schema-validated brief before the writer runs.

Quick Start

1

Define Schema + Create TypedHandoff

2

Execute with Validated Payload

3

Invalid Payload Raises Immediately


How It Works


Configuration


Accepted Payload Types


Common Patterns

Research → Writer Pipeline

Customer Info Pipeline

Async Typed Handoffs

Combining with HandoffConfig

Receiving agent: input_payload_schema

Use input_payload_schema on the receiving agent to declare the Pydantic model it expects as incoming payload. This ensures that any agent sending data to this agent produces a payload that matches the declared schema — mismatches raise HandoffValidationError at the boundary.
When the sending agent calls TypedHandoff(agent=receiver, input_schema=DeployPayload).execute_programmatic(...) with an invalid payload, HandoffValidationError is raised:

Best Practices

Only include fields the receiving agent actually needs. Large schemas increase validation overhead and complexity.
Always catch HandoffValidationError at orchestration boundaries to handle schema mismatches gracefully:
Use e.validation_errors to surface field-level issues to users:
Use typed handoffs when passing more than 2 fields between agents. The validation cost is much lower than debugging wrong LLM output.
TypedHandoff requires Pydantic. Document the requirement:
Instantiating without Pydantic raises ImportError.

Handoffs

Plain handoffs (string payloads, no validation)

Handoff Filters

Filtering conversation history during handoffs

Handoff Config

Timeouts, retries, concurrency settings

Multi-Agent Patterns

Design patterns for agent collaboration