Skip to content
Agent

Sub-Agents

by ArtificialAnalysis

AI Summary

Sub-Agents is a lightweight framework for decomposing complex tasks into specialized child agents that collaborate under a parent orchestrator agent. Developers building multi-agent systems in Python will benefit from this pattern for creating modular, reusable agent hierarchies.

Install

Copy this and paste it into Claude Code, Cursor, or any AI assistant:

I want to set up the "Sub-Agents" agent in my project.

Please run this command in my terminal:
# Add AGENTS.md to your project root
curl --retry 3 --retry-delay 2 --retry-all-errors -o AGENTS.md "https://raw.githubusercontent.com/ArtificialAnalysis/Stirrup/main/docs/guides/sub-agents.md"

Then explain what the agent does and how to invoke it.

Description

The lightweight framework for building agents

Overview

Any Agent can be converted to a Tool using the .to_tool() method. This allows a parent agent to delegate tasks to specialized child agents.

Sub-Agents

Sub-agents allow you to break complex tasks into specialized agents that work together.

Basic Pattern

`python import asyncio from stirrup import Agent from stirrup.clients.chat_completions_client import ChatCompletionsClient from stirrup.tools import WebToolProvider async def main(): # Create client for OpenAI (shared across agents) client = ChatCompletionsClient( base_url="https://api.openai.com/v1", model="gpt-5", ) # Create a specialist agent researcher = Agent( client=client, name="researcher", tools=[WebToolProvider()], system_prompt="You are a research specialist. Find accurate information.", ) # Convert to a tool for the parent research_tool = researcher.to_tool( description="Research a topic and return findings", ) # Parent agent uses the sub-agent orchestrator = Agent( client=client, name="orchestrator", tools=[research_tool], ) async with orchestrator.session() as session: await session.run( "Research the latest developments in quantum computing" ) asyncio.run(main()) `

The `to_tool()` Method

`python agent.to_tool( description="Description of what this sub-agent does", system_prompt=None, # Optional override for sub-agent's system prompt ) ` Returns a Tool[SubAgentParams, SubAgentMetadata].

Discussion

0/2000
Loading comments...

Health Signals

MaintenanceCommitted 6d ago
Active
Adoption100+ stars on GitHub
345 ★ · Growing
DocsMissing or thin
Undocumented

GitHub Signals

Stars345
Forks35
Issues6
Updated6d ago
View on GitHub
MIT License

My Fox Den

Community Rating

Sign in to rate this booster

Works With

Claude Code
Claude.ai