> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upsonic.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent as Tool

> Use other agents as tools for hierarchical agent architectures

## Overview

Use other agents as tools for hierarchical agent architectures.

## Usage

```python theme={null}
from upsonic import Agent, Task

# Create a specialized agent
research_agent = Agent(
    name="Research Specialist",
    model="anthropic/claude-sonnet-4-5",
    system_prompt="You are a research specialist focused on gathering information."
)

# Use the specialized agent as a tool
task = Task(
    description="Research current AI trends and provide a summary",
    tools=[research_agent]
)

# Main agent delegates to specialized agent
main_agent = Agent(
    name="Main Coordinator",
    model="anthropic/claude-sonnet-4-5"
)

result = main_agent.print_do(task)
print("Result:", result)
```

## Parameters

* Any agent instance can be used as a tool
* The agent's `name`, `role`, `goal`, and `system_prompt` are used to generate the tool description
* Tool name format: `ask_{agent_name}`
