Multi-agent graphs¶
Primitives for dynamic, LLM-routed multi-agent systems where the topology is decided at runtime rather than declared up front.
AgentPool— a name-keyed registry exposed to agents as a singleroute(agent_name, task)tool. Lets agents delegate to each other by name (resolving the circular-reference problem that a frozen tool map otherwise imposes) and bounds recursion viamax_depth.conclude— a non-local exit: any agent, however deeply nested, can callconclude("answer")to end the whole task and return its answer straight to the originating top-levelAgent.run. Raised internally asConcludeSignal(aBaseException) and caught only at the top level.
Pair them with LLMEngine(max_tool_calls_per_turn=1) to keep the graph on a
single non-branching path. For narrative usage see
Guides → Mid → Dynamic graph.
lazybridge.AgentPool ¶
Registry of named agents, exposed to the LLM as a single route tool.
Source code in lazybridge/pool.py
register ¶
Add agents to the pool, keyed by their name.
Source code in lazybridge/pool.py
roster ¶
One line per registered agent — drop into the members' system prompt.
route
async
¶
Delegate task to the named specialist agent and return its answer.
Source code in lazybridge/pool.py
as_tool ¶
Wrap routing as a route(agent_name, task) tool for tools=[...].
Pass a distinct name to give one agent access to several pools
without a tool-name collision, e.g.
tools=[my_team.as_tool("ask_team"), peers.as_tool("ask_peer")].
Source code in lazybridge/pool.py
lazybridge.conclude ¶
End the whole task now and return message as the final answer.
Use as a tool in multi-agent graphs: any agent — however deeply nested —
can call conclude("…") to short-circuit the entire call chain and
return its answer directly to the original caller.
Immediacy note: the exit fires as soon as the turn's tool calls settle.
If the model emits conclude alongside other tool calls in the same
turn, those siblings still run to completion first (they execute
concurrently via asyncio.gather), so a slow sibling can delay the
exit. Set LLMEngine(max_tool_calls_per_turn=1) — the recommended
multi-agent configuration — to keep one call per turn and avoid this.