Agent Relationships
Copy page
Learn how to add agent relationships to your agent graph
Agent relationships are used to coordinate specialized agents for complex workflows. This framework implements agent relationships through using canDelegateTo()
and canTransferTo()
, allowing a parent agent to automatically coordinate specialized agents for complex workflows.
Understanding Agent Relationships
The framework supports two types of agent relationships:
Transfer Relationships
Transfer relationships completely relinquish control from one agent to another. When an agent hands off to another:
- The source agent stops processing
- The target agent takes full control of the conversation
- Control is permanently transferred until the target agent hands back
Delegation Relationships
Delegation relationships are used to pass a task from one agent to another while maintaining oversight:
- The source agent remains in control
- The target agent executes a specific task
- Results are returned to the source agent
- The source agent continues processing
When to Use Each Relationship
Use Transfers for Complex Tasks
Use canTransferTo
when the task is complex and the user will likely want to ask follow-up questions to the specialized agent:
- Customer support conversations - User may have multiple related questions
- Technical troubleshooting - Requires back-and-forth interaction
- Order management - User might want to modify, track, or ask about multiple aspects
- Product consultations - Users often have follow-up questions
Use Delegation for Simple Tasks
Use canDelegateTo
when the task is simple and self-contained:
- Data retrieval - Get a specific piece of information and return it
- Calculations - Perform a computation and return the result
- Single API calls - Make one external request and return the data
- Simple transformations - Convert data from one format to another