Loading…
Loading…
Features · Scale · Sub-agents
Delegation is the agent noticing a task is several tasks and splitting it across sub-agents that each hold their own context. A sub-agent reads a long file and returns four sentences; only those enter the parent's context.
from shipit_agent import Agentagent = Agent(llm=llm, tools=tools, delegation=True)agent.run("Read all 4 reports and summarise each one")# → four children, four summaries, one join
Lead agent
sees a separable task
Sub-agents
own context, in parallel
Short answers
not the whole file
One join
back in the lead
The code is a checked example from the docs; the output is an example of what it prints.
from shipit_agent import Agent
agent = Agent(llm=llm, tools=tools, delegation=True)
agent.run("Read all 4 reports and summarise each one")
# → four children, four summaries, one join6 more ways to use it
Each example is from the docs and checked against the library.
An agent can call another as a tool: a reviewer, a researcher, a specialist with its own prompt and model.
from shipit_agent import Agent
from shipit_agent.llms import build_llm_from_env
llm = build_llm_from_env()
reviewer = Agent.with_builtins(llm=llm, name="reviewer", prompt="Review code for bugs. Be specific.")
lead = Agent.with_builtins(llm=llm, tools=[reviewer.as_tool(description="Reviews a diff for bugs.")])Context, not speed
Each child's reading stays out of the parent's window.
Only when it helps
A single-step task is never offered a sub-agent.
Background children
Independent work runs at once and joins later.
Agents as tools
Or hand a specialist agent to another as a tool.
| Parameter | Default | What it does |
|---|---|---|
| delegation | None | Reach for sub-agents without being asked: guarantee a `sub_agent` tool exists, and when a task carries delegation signals (a per-item verb, an enumerated work list, a wide sweep) append a directive naming what was detected. The model still decides — it decides with the tool present and the case put plainly. |
| agents | empty | Named sub-agents: `{"reviewer": { "description": ..., "prompt": ..., "tools": [...], "model": ...}}`. Defining any gives the agent a `sub_agent` tool that lists them. |
| max_tool_concurrency | None | None means no cap; otherwise bound concurrent local tool calls per turn. |