The first draft of an agent is rarely the best one. How do you get a second pass without writing a whole new pipeline?
Call the agent twice? The second time with the first response as input plus some instruction to improve it?
Exactly the shape. Two agents, two roles. The drafter writes; the reviser critiques and rewrites. Same model, two different system_prompt values:
drafter = Agent(model, system_prompt="Write a draft.")
reviser = Agent(model, system_prompt="Rewrite to be clearer and more concise.")
draft = drafter.run_sync(topic).output
final = reviser.run_sync(draft).outputAnd the reviser's input is literally the drafter's output string? I hand one agent's .output directly to the other?
Plain string hand-off. No orchestration framework, no queue — one variable passed to the next call. The full function:
def refine_once(topic: str) -> str:
drafter = Agent(model, system_prompt="Write a short, useful draft on the topic.")
reviser = Agent(model, system_prompt="Rewrite the text to be clearer and more concise.")
draft = drafter.run_sync(topic).output
final = reviser.run_sync(draft).output
return finalWhy two separate agents? Could one agent do both jobs if I phrase the prompt cleverly?
You can try, but two focused roles produce more reliable output than one role asked to hold two personalities. The drafter optimizes for content. The reviser optimizes for structure. Each agent stays narrow, each result stays predictable.
So refinement is just draft variable + reviser call. One extra line and the agent edits itself?
One extra line. Stack three agents — draft, revise, polish — and you have a three-pass editor. Same pattern, more rounds, as many as the task needs.
TL;DR: one agent drafts, another revises — the reviser's input is the drafter's output.
system_prompt optimized for content generationsystem_prompt optimized for critique and rewritingfinal = reviser.run_sync(draft).output| One agent | Two agents |
|---|---|
| Drafts and revises in one call | Separate roles, cleaner prompts |
| Prompt juggling | Linear composition |
Most reliable refinement keeps each agent focused on a single responsibility.
The first draft of an agent is rarely the best one. How do you get a second pass without writing a whole new pipeline?
Call the agent twice? The second time with the first response as input plus some instruction to improve it?
Exactly the shape. Two agents, two roles. The drafter writes; the reviser critiques and rewrites. Same model, two different system_prompt values:
drafter = Agent(model, system_prompt="Write a draft.")
reviser = Agent(model, system_prompt="Rewrite to be clearer and more concise.")
draft = drafter.run_sync(topic).output
final = reviser.run_sync(draft).outputAnd the reviser's input is literally the drafter's output string? I hand one agent's .output directly to the other?
Plain string hand-off. No orchestration framework, no queue — one variable passed to the next call. The full function:
def refine_once(topic: str) -> str:
drafter = Agent(model, system_prompt="Write a short, useful draft on the topic.")
reviser = Agent(model, system_prompt="Rewrite the text to be clearer and more concise.")
draft = drafter.run_sync(topic).output
final = reviser.run_sync(draft).output
return finalWhy two separate agents? Could one agent do both jobs if I phrase the prompt cleverly?
You can try, but two focused roles produce more reliable output than one role asked to hold two personalities. The drafter optimizes for content. The reviser optimizes for structure. Each agent stays narrow, each result stays predictable.
So refinement is just draft variable + reviser call. One extra line and the agent edits itself?
One extra line. Stack three agents — draft, revise, polish — and you have a three-pass editor. Same pattern, more rounds, as many as the task needs.
TL;DR: one agent drafts, another revises — the reviser's input is the drafter's output.
system_prompt optimized for content generationsystem_prompt optimized for critique and rewritingfinal = reviser.run_sync(draft).output| One agent | Two agents |
|---|---|
| Drafts and revises in one call | Separate roles, cleaner prompts |
| Prompt juggling | Linear composition |
Most reliable refinement keeps each agent focused on a single responsibility.
Create a free account to get started. Paid plans unlock all tracks.