Skip to main content
The Agent Invocation Tool enables agents to call other specialized agents, creating multi-agent architectures and complex workflows.

Overview

Tool Name: ago_agent_invocation This tool allows a main agent to delegate tasks to specialized sub-agents, enabling sophisticated multi-agent systems where different agents handle different domains or tasks.

Key Features

  • Call specialized agents from a general agent
  • Circular call detection (prevents infinite loops)
  • Optional context sharing between agents
  • Configurable call depth limits
  • Automatic response integration

Architecture

Multi-Agent Pattern

Benefits


Configuration

Enable Agent as Tool

To enable an agent to be called as a tool:
  1. Navigate to AI StudioAgents
  2. Select the agent you want to enable as a tool
  3. Go to the Settings tab
  4. Enable Can be used as tool
  5. Enter a clear Tool Description that explains when this agent should be called
  6. Click Save

Configuration Fields

Assign Agent Tools

To configure which agents the main agent can invoke:
  1. Navigate to AI StudioAgents
  2. Select the main (router) agent
  3. Go to the Agent Tools tab
  4. Add the specialized agents you want to make available
  5. Click Save

Tool Description

Write clear tool descriptions to help the main agent route correctly:

Good Examples

Bad Examples


Routing Logic

Main Agent Prompt

Configure routing in the main agent’s prompt:

Context Sharing

Without Context Sharing (Default)

The sub-agent receives only the current message:

With Context Sharing

To enable context sharing, go to the sub-agent’s settings and enable Share Conversation Context. When enabled, the sub-agent receives:
  • Full conversation history from the parent agent
  • Current user message
  • Sub-agent’s own knowledge sources

When to Use Context Sharing


Call Depth Protection

Preventing Infinite Loops

The max call depth setting prevents circular calls:

Default Limits

Configure the max call depth in the agent settings. The default is 5 levels deep, which is sufficient for most use cases. For simpler architectures, consider setting it to 2–3.

Circular Call Detection

The system automatically detects and prevents:
  • Agent A calling Agent B calling Agent A
  • Self-invocation (Agent A calling Agent A)

Response Flow

Invocation Sequence

Response Integration

The main agent can:
  • Pass through sub-agent response directly
  • Summarize or format the response
  • Add additional context
  • Combine with other information

Examples

Customer Support Router

To set up a customer support routing system: Step 1: Create Specialized Agents For each specialized agent:
  1. Create the agent in AI StudioAgents
  2. Enable Can be used as tool
  3. Add a clear tool description
  4. Assign relevant knowledge sources
Step 2: Create the Router Agent
  1. Create a new agent named “Support Assistant”
  2. In Agent Tools, add Technical Support and Billing Support
  3. Configure the prompt template with routing logic (see Routing Logic section above)

Escalation Chain


Best Practices

Agent Design

  • Clear boundaries: Each agent should have distinct responsibilities
  • Minimal overlap: Avoid ambiguous routing decisions
  • Focused knowledge: Assign only relevant sources to each agent
  • Consistent tone: Maintain brand voice across all agents

Routing Logic

  • Explicit triggers: Define clear routing keywords
  • Fallback handling: Default behavior for unclear requests
  • Confirmation: Consider confirming routing for complex queries
  • Logging: Track routing decisions for optimization

Performance

  • Limit depth: Keep the max call depth low (2–3 for most cases)
  • Selective context: Only share context when necessary
  • Monitor latency: Multi-agent calls add response time
  • Cache patterns: Identify common routing patterns

Troubleshooting

Problem: Main agent doesn’t see target agent as available tool.Solutions:
  1. Verify “Enable as Tool” is turned on for the target agent
  2. Check the target agent is in the main agent’s Agent Tools list
  3. Ensure both agents are active
  4. Verify target agent has a tool description set
Problem: Error about circular calls or max depth exceeded.Solutions:
  1. Review agent tool assignments for circular references
  2. Increase the max call depth if legitimately needed
  3. Simplify agent hierarchy
  4. Check if agent is calling itself
Problem: Main agent doesn’t use sub-agent’s response correctly.Solutions:
  1. Review main agent’s prompt for response handling instructions
  2. Check the “Share Conversation Context” setting
  3. Verify sub-agent is returning expected format
  4. Test sub-agent directly to verify responses
Problem: Main agent routes to incorrect sub-agent.Solutions:
  1. Improve tool descriptions with clearer boundaries
  2. Add more specific routing rules to main agent’s prompt
  3. Add negative examples (“Do NOT use this agent for…”)
  4. Review and refine keyword triggers

API Reference

See Public API v1 Reference for agent management endpoints.