AI SummarySub-Agents enables parent agents to delegate specialized tasks to child agent loops with independent prompts, tools, and providers, allowing developers to build modular, composable multi-agent systems. This is valuable for teams building complex AI workflows that require task specialization and isolation.
Install
# Add AGENTS.md to your project root curl -o AGENTS.md "https://raw.githubusercontent.com/yologdev/yoagent/main/docs/concepts/sub-agents.md"
Description
Sub-agents let a parent agent delegate tasks to child agent loops, each with their own system prompt, tools, and provider. The parent LLM invokes them like any other tool.
Overview
` Parent Agent ├── prompt("Research X and implement Y") │ ├── calls SubAgentTool("researcher", task="Research X") │ │ └── child agent_loop() with read/search tools → returns findings │ ├── calls SubAgentTool("coder", task="Implement Y based on findings") │ │ └── child agent_loop() with edit/write tools → returns result │ └── summarizes both results ` Each sub-agent invocation starts a fresh conversation — no state leaks between calls.
Sub-Agents
Sub-agents let a parent agent delegate tasks to child agent loops, each with their own system prompt, tools, and provider. The parent LLM invokes them like any other tool.
Creating Sub-Agents
`rust use std::sync::Arc; use yoagent::sub_agent::SubAgentTool; use yoagent::provider::AnthropicProvider; use yoagent::tools; let researcher = SubAgentTool::new("researcher", Arc::new(AnthropicProvider)) .with_description("Searches and reads files to gather information.") .with_system_prompt("You are a research assistant. Be thorough and concise.") .with_model("claude-sonnet-4-20250514") .with_api_key(&api_key) .with_tools(vec![ Arc::new(tools::ReadFileTool::new()), Arc::new(tools::SearchTool::new()), ]) .with_max_turns(10); `
Registering on a Parent Agent
`rust use yoagent::agent::Agent; let mut agent = Agent::new(AnthropicProvider) .with_system_prompt("You coordinate between sub-agents.") .with_model("claude-sonnet-4-20250514") .with_api_key(api_key) .with_sub_agent(researcher) .with_sub_agent(coder); ` The parent sees sub-agents as regular tools. It decides when to delegate based on its system prompt.
Quality Score
Good
86/100
Trust & Transparency
Open Source — MIT
Source code publicly auditable
Verified Open Source
Hosted on GitHub — publicly auditable
Actively Maintained
Last commit Today
69 stars
11 forks