Skip to main content

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

Key Features:
  • 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
Requirements:
  • Must use Pipeline architecture (enforced by API)
  • Acts as orchestrator/controller
  • Cannot be Realtime or Text architecture
Automatic Tools Created:

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)
Automatic Tools Created:
Inherited Settings:
  • ✅ Functions (enabled on parent)
  • ✅ Knowledge bases (linked to parent)
  • ✅ Organization context
  • ✅ Authentication
Independent Settings:
  • ✅ System prompt
  • ✅ Model (can differ from parent)
  • ✅ Temperature
  • ✅ Voice (for realtime/pipeline)

Step 1: Create Parent Agent

Configure Parent Agent

  1. Create a new agent with Pipeline architecture
  2. Set up basic configuration:
    • Name: “Customer Support Main”
    • System prompt: Orchestration logic
    • Model: GPT-4o or similar (for reasoning)
    • Voice: Professional, clear
Subagents only work with Pipeline architecture. If you try to add subagents to a Realtime or Text agent, the API will return an error.

Parent Agent System Prompt


Step 2: Create Subagents

Create Subagent via Studio

  1. Go to your agent → SettingsSubagents section
  2. Click Add Subagent
  3. Configure subagent:
  1. Click Save

Create Subagent via API

Response:

Example Subagent Prompts

Technical Support Subagent:
Billing Subagent:

Step 3: Understanding Automatic Handoffs

How Handoff Tools Work

When you create subagents, the system automatically creates tools for navigation: Parent Agent Gets:
Each Subagent Gets:

Handoff Strategies

1. Sequential Handoff
Use Case: Structured workflows (support, sales) Example:
2. Conditional Handoff
Use Case: Multi-department support 3. Consultative Handoff
Use Case: Specialized queries within general conversation

Implementing Handoff in System Prompt


Step 4: Manage Subagents

List Subagents

Via Studio:
  • Go to your agent → SettingsSubagents
  • See all subagents in creation order
Via API:
Response:

Update Subagent

Via Studio:
  1. Go to agent → SettingsSubagents
  2. Click Edit (pencil icon) on subagent
  3. Modify settings
  4. Click Save
Via API:

Delete Subagent

Via Studio:
  1. Go to agent → SettingsSubagents
  2. Click Delete (trash icon)
  3. Confirm deletion
Via API:
Response:

Advanced Patterns

Pattern 1: Tiered Support

Use Case: Multi-tier support organizations

Pattern 2: Department-Based Routing

Use Case: Company phone systems

Pattern 3: Geographic Routing

Use Case: Multi-language support

Pattern 4: Task-Specialized Pipeline

Use Case: Highly structured workflows

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

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

Check:
  1. Is subagent properly configured with name and description?
  2. Does parent prompt mention when to use handoff tools?
  3. Are trigger conditions clearly defined in parent prompt?
  4. Is function calling enabled on the parent agent?
Fix: Add explicit handoff examples to parent prompt:
Problem: Handoff protocol not defined clearly.Solution: Add to parent prompt:
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”
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
Problem: The subagent ID doesn’t exist or doesn’t belong to this agent.Solution:
  1. Verify the subagent ID with GET /api/agents/{agentId}/subagents
  2. Ensure you’re using the correct agent ID in the URL
  3. Check that the subagent wasn’t deleted
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

Validation Errors:

List Subagents

Response:

Update Subagent

Delete Subagent

Response:

Technical Implementation

Backend Architecture

Subagents are implemented using the Unified Agent system in the backend:
  1. Parent Agent receives UnifiedAgentConfig with subagents array
  2. Handoff Tools are automatically generated for each subagent
  3. Subagent Personas are created as separate agent instances
  4. 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.