Multi-agent pipeline
Three agents, each with one job, wired end to end.
The program, and what it printed
This ran against effGen with gemini:gemini-3.1-flash-lite. The pane under the code is that run’s output, pasted — so where the answer depends on a live API or on the model’s wording, yours will differ. The pane is the shape that run actually had, not a tidied one.
from effgen import Agent, AgentConfig
from effgen.tools.builtin import Calculator
MODEL = "gemini:gemini-3.1-flash-lite"
analyst = Agent(AgentConfig(
model=MODEL,
name="analyst",
system_prompt="Restate the task as one arithmetic question. Nothing else.",
))
solver = Agent(AgentConfig(
model=MODEL,
name="solver",
system_prompt="Answer with the calculator. Give the number only.",
tools=[Calculator()],
))
writer = Agent(AgentConfig(
model=MODEL,
name="writer",
system_prompt="Write one sentence reporting the result to a manager.",
))
question = analyst.run("A team of 14 people each bill 37 hours at $145. What is the invoice?")
answer = solver.run(question.text)
summary = writer.run(f"Question: {question.text}\nAnswer: {answer.text}")
print("analyst:", question.text.strip()[:120])
print("solver :", answer.text.strip())
print("writer :", summary.text.strip())analyst: 14 * 37 * 145 = ? solver : 75110 writer : The calculation of 14 * 37 * 145 results in a total of 75,110.
What it does
One agent restates the task, one solves it with a tool, one writes it up. Each has a narrow system prompt and only the tools it needs, which is what makes a small model reliable at its step. The framework also has a sub-agent router that decomposes a task on its own, and workflow DAGs with resumable checkpoints — but a pipeline you wired yourself is the version you can debug.
What the run shows
- A plain run() no longer fans out into sub-agents on its own — AgentConfig.mode defaults to SINGLE. Automatic decomposition is opt-in.
- The solver has a calculator and an instruction to give the number only. The arithmetic is the tool's, not the model's.
- Each step's output is just a string, so there is nothing to learn: the pipeline is three calls in a row.
The full script
The program above is the short version. The one in the repository at examples/advanced/multi_agent_pipeline.py covers more cases and takes a --model flag. It ships with the package, so it runs from the command line without cloning anything:
effgen examples run advanced/multi_agent_pipelineRead it on GitHub