Documentation Index
Fetch the complete documentation index at: https://polos.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
Coordinate multiple specialized agents to review and refine content.
Define specialist agents
from polos import Agent
grammar_agent = Agent(
id="grammar_reviewer",
provider="openai",
model="gpt-4o-mini",
system_prompt="Review text for grammar, spelling, and punctuation.",
)
tone_agent = Agent(
id="tone_reviewer",
provider="openai",
model="gpt-4o-mini",
system_prompt="Review text for tone consistency and style.",
)
editor_agent = Agent(
id="final_editor",
provider="openai",
model="gpt-4o-mini",
system_prompt="Produce a polished version incorporating all feedback.",
)
Run agents in parallel
from polos import workflow, WorkflowContext
@workflow(id="blog_review")
async def blog_review(ctx: WorkflowContext, payload):
text = payload["text"]
# Run all reviews in parallel
reviews = await ctx.step.batch_agent_invoke_and_wait(
"parallel_reviews",
[
grammar_agent.with_input(f"Review for grammar:\n\n{text}"),
tone_agent.with_input(f"Review for tone:\n\n{text}"),
]
)
grammar_feedback = reviews[0].result.result
tone_feedback = reviews[1].result.result
# Final edit with all feedback
final = await ctx.step.agent_invoke_and_wait(
"final_edit",
editor_agent.with_input(f"""Original: {text}
Grammar feedback: {grammar_feedback}
Tone feedback: {tone_feedback}
Produce the final polished version.""")
)
return {"final_text": final.result}
Run it
git clone https://github.com/polos-dev/polos.git
cd polos/python-examples/14-router-coordinator
cp .env.example .env # Add your POLOS_PROJECT_ID and API key
uv sync
python main.py
Open http://localhost:5173 to view your agents and workflows, run them from the UI, and see execution traces.
Python example on GitHub | TypeScript example on GitHub