ConnectOnionConnectOnion

subagents

Spawn specialized sub-agents to handle specific tasks. Delegate work to focused agents with their own tools, model, and system prompt.

Parent agent calls task(prompt, agent_type) → sub-agent runs and returns result. Built-in agents included.

Quick Start

main.py
1from connectonion import Agent 2from connectonion.useful_plugins import subagents 3 4agent = Agent("main", plugins=[subagents], model="co/gemini-2.5-pro") 5 6# The agent can now delegate to sub-agents 7agent.input("explore the codebase and explain the architecture")
Python REPL
Interactive
[agent] Delegating to explore sub-agent...
[sub-explore] Reading project structure...
[sub-explore] Found: agent.py, llm.py, tool_executor.py...
 
Architecture summary:
- agent.py: Main orchestrator with event system
- llm.py: Multi-provider LLM abstraction
- tool_executor.py: Tool execution with xray context
...

AGENT.md Format

Create a file at .co/agents/name/AGENT.md:

code
1--- 2name: reviewer 3description: Code reviewer that checks for bugs and style issues 4model: co/claude-opus-4-5 5max_iterations: 10 6tools: 7 - glob 8 - grep 9 - read_file 10--- 11 12You are a code reviewer. Find bugs, style issues, and improvements. 13Return a structured report with findings and line numbers.
FieldRequiredDescription
nameyesAgent identifier (used in task() calls)
descriptionyesShown to parent agent when choosing sub-agent
modelnoDefault: co/gemini-2.5-pro
max_iterationsnoDefault: 10
toolsnoList of tool names to give the sub-agent

Available tool names:

glob, grep, read_file, edit, multi_edit, write, bash, WebFetch, Memory, Browser

Agent Discovery

Agents are discovered in priority order:

code
1.co/agents/{name}/AGENT.md # Project-level (highest priority) 2~/.co/agents/{name}/AGENT.md # User-level 3builtin/{name}/AGENT.md # Built-in agents (lowest priority)

Project-level agents override built-ins. Built-in agents are bundled with co ai for common tasks like codebase exploration and planning.

Events used

EventHandlerPurpose
on_agent_readyinitialize_subagentsDiscover agents, register task() tool

Enjoying ConnectOnion?

⭐ Star us on GitHub = ☕ Coffee chat with our founder. We love meeting builders.