Skip to main content

Multi-agent pipeline

Agents run in a fixed order and each builds on the last. Here a researcher feeds a writer, using workflow routing.

This example: a briefing pipeline. A researcher gathers notes from the web, then a writer turns them into a one-page executive brief. Every request goes through both steps.

Example (replies vary)
You: Brief me on RAG evaluation methods.

→ research: bullet-point notes with sources
→ writer: turns the notes into a brief

Agent: RAG evaluation: executive brief
Summary: Teams measure two things, retrieval quality and answer
quality ...
Key methods: ...
Recommendation: ...

contributing_agents: ["research", "writer"]
from custodian_labs import Custodian, CustodianSquad

squad = CustodianSquad(
custodians=[
Custodian(
name="research",
model="gpt-6-luna",
system_prompt="Research the topic on the web. Produce bullet-point notes with sources.",
tools=["web_search", "scrape_url"],
output_key="research_notes",
),
Custodian(
name="writer",
model="gpt-6-luna",
system_prompt="Write a one-page executive brief from the research notes.",
),
],
routing_mode="workflow",
workflow_order=["research", "writer"],
)

reply = squad.deploy().chat("Brief me on RAG evaluation methods.")
print(reply.contributing_agents) # ['research', 'writer']
print(reply.response)
Learn more