Overview
Subagents allow you to create a hierarchy of agents where a parent agent delegates specific tasks to specialized child agents. This enables more complex, modular, and maintainable agent architectures. TalkifAI automatically creates handoff tools for each subagent, allowing the parent agent to seamlessly transfer conversations to specialists when needed. Best for:- Complex workflows with multiple stages
- Agents requiring different expertise areas
- Scalable agent systems
- Separation of concerns in conversation handling
How It Works
- Automatic handoff tools — Parent agent automatically gets
transfer_to_{subagent}tools - Return mechanism — Subagents can return control to parent agent
- Sibling handoffs — Subagents can transfer to other subagents
- Inherited settings — Subagents inherit parent’s functions and knowledge bases
Architecture
Parent Agent
The parent agent is the main entry point:- Receives all incoming calls
- Handles initial greeting and triage
- Has automatic handoff tools to transfer to subagents
- Manages conversation flow
- Handles closing and follow-up
- Must use Pipeline architecture (enforced by API)
- Acts as orchestrator/controller
- Cannot be Realtime or Text architecture
Subagents
Subagents are specialized agents:- Handle specific conversation stages
- Have their own system prompts and models
- Can use different voices and temperatures
- Inherit parent’s functions automatically
- Cannot be called directly by users (only via parent)
- ✅ Functions (enabled on parent)
- ✅ Knowledge bases (linked to parent)
- ✅ Organization context
- ✅ Authentication
- ✅ System prompt
- ✅ Model (can differ from parent)
- ✅ Temperature
- ✅ Voice (for realtime/pipeline)
Step 1: Create Parent Agent
Configure Parent Agent
- Create a new agent with Pipeline architecture
- Set up basic configuration:
- Name: “Customer Support Main”
- System prompt: Orchestration logic
- Model: GPT-4o or similar (for reasoning)
- Voice: Professional, clear
Parent Agent System Prompt
Step 2: Create Subagents
Create Subagent via Studio
- Go to your agent → Settings → Subagents section
- Click Add Subagent
- Configure subagent:
| Field | Required | Description |
|---|---|---|
| Name | ✅ | Internal identifier (e.g., “Technical Support”) |
| Description | ✅ | What this subagent handles (used by parent for routing) |
| System Prompt | ✅ | Specialized instructions for this subagent |
| Model | ❌ | Defaults to parent’s model (GPT-4o Mini, GPT-4.1, or Gemini) |
| Temperature | ❌ | Defaults to 0.7 (0.0-1.0 range) |
| Function Calling | ❌ | Inherited from parent + custom functions |
- Click Save
Create Subagent via API
Example Subagent Prompts
Technical Support Subagent:Step 3: Understanding Automatic Handoffs
How Handoff Tools Work
When you create subagents, the system automatically creates tools for navigation: Parent Agent Gets:Handoff Strategies
1. Sequential HandoffImplementing Handoff in System Prompt
Step 4: Manage Subagents
List Subagents
Via Studio:- Go to your agent → Settings → Subagents
- See all subagents in creation order
Update Subagent
Via Studio:- Go to agent → Settings → Subagents
- Click Edit (pencil icon) on subagent
- Modify settings
- Click Save
Delete Subagent
Via Studio:- Go to agent → Settings → Subagents
- Click Delete (trash icon)
- Confirm deletion
Advanced Patterns
Pattern 1: Tiered Support
Pattern 2: Department-Based Routing
Pattern 3: Geographic Routing
Pattern 4: Task-Specialized Pipeline
Best Practices
Clear Responsibilities
Each subagent should have a well-defined scope. Avoid overlap between subagents to prevent confusion.
Descriptive Names
Use clear, descriptive names for subagents. The parent agent uses these names to decide which handoff tool to call.
Consistent Voice
Use similar voice settings across subagents for a cohesive customer experience.
Context Preservation
Write system prompts that reference conversation history. Subagents can see the full conversation so far.
Fallback Handling
Always have a fallback — instruct subagents to use return_to_parent if they can’t help.
Test End-to-End
Test full conversation flows including all handoffs before going live. Verify each transfer works smoothly.
Limitations
Current Limitations
| Limitation | Workaround |
|---|---|
| Subagents only work with Pipeline architecture | Use Pipeline for parent agent (required) |
| Subagents inherit parent’s functions | Configure all needed functions on parent agent |
| Handoff is tool-based (LLM decides) | Write clear system prompts with handoff examples |
| Subagents can’t be called directly | All calls must go through parent agent |
| No nested subagents | Use sibling handoffs instead (subagent → subagent) |
Technical Notes
- Maximum subagents: No enforced limit (test with your use case)
- Model flexibility: Each subagent can use different models
- Voice independence: Subagents can have different voice settings
- Function inheritance: All parent functions available to subagents
Troubleshooting
Subagent isn't being activated
Subagent isn't being activated
Check:
- Is subagent properly configured with name and description?
- Does parent prompt mention when to use handoff tools?
- Are trigger conditions clearly defined in parent prompt?
- Is function calling enabled on the parent agent?
Handoff is abrupt or confusing
Handoff is abrupt or confusing
Problem: Handoff protocol not defined clearly.Solution: Add to parent prompt:
Subagent loses conversation context
Subagent loses conversation context
Problem: Context not passed during handoff.Solution: This shouldn’t happen — subagents automatically see the full conversation history. If issues persist:
- Include context summary in subagent’s system prompt
- Use return_to_parent with context: “I’ve helped with X, but Y needs parent assistance”
Too many subagents causing confusion
Too many subagents causing confusion
Problem: Over-complicated agent hierarchy.Solution:
- Consolidate similar subagents
- Use conditional logic in parent prompt instead of separate subagents
- Limit to 3-5 subagents for most use cases
API returns 'Subagent not found'
API returns 'Subagent not found'
Problem: The subagent ID doesn’t exist or doesn’t belong to this agent.Solution:
- Verify the subagent ID with
GET /api/agents/{agentId}/subagents - Ensure you’re using the correct agent ID in the URL
- Check that the subagent wasn’t deleted
Can't add subagent to agent
Can't add subagent to agent
Error: “Subagents can only be added to pipeline architecture agents”Solution: Change the parent agent’s architecture to Pipeline, or create a new Pipeline agent.
API Reference
Create Subagent
| Status | Error | Cause |
|---|---|---|
400 | ”Subagent name is required” | Missing or empty name |
400 | ”System message is required” | Missing or empty sysMsg |
400 | ”Subagents can only be added to pipeline architecture agents” | Parent is not Pipeline |
403 | ”You don’t have permission…” | User lacks edit rights |
List Subagents
Update Subagent
Delete Subagent
Technical Implementation
Backend Architecture
Subagents are implemented using the Unified Agent system in the backend:- Parent Agent receives
UnifiedAgentConfigwithsubagentsarray - Handoff Tools are automatically generated for each subagent
- Subagent Personas are created as separate agent instances
- Session Management handles seamless transfers between agents
Handoff Tool Generation
Session Flow
Next Steps
Create Parent Agent
Set up your main orchestrator agent with Pipeline architecture.
Add Subagents
Create specialized subagents for different tasks via Studio or API.
Test Handoffs
Test conversation flows with subagent transfers to verify smooth handoffs.
Monitor Performance
Track which subagents are used most and optimize accordingly.
Related Documentation
- Agent Architecture — Pipeline vs Realtime vs Text
- Custom Functions — Add actions to your agents
- System Prompt Guide — Writing effective prompts
- API Reference — Full agents API documentation