Parallel agent runs
Skill kjuhwa/skills-hub/skills/llm-agents/parallel-agent-runs
Run multiple agent instances concurrently with asyncio.gather() and pick the best result.From its SKILL.md
npx -y skills add kjuhwa/skills-hub --skill parallel-agent-runsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.3 KB, 388 tokens by cl100k_base, as published. Nobody here has run it
parallel-agent-runs
Run the same (or different) agents in parallel using asyncio.gather(). Wrap the whole workflow in trace() to see all runs in a single trace. Use a picker/judge agent to select the best output.
When to apply
Best-of-N sampling, multi-language translation in one pass, or any task where independent subtasks can execute concurrently to reduce wall-clock time.
Core snippet
import asyncio
from agents import Agent, ItemHelpers, Runner, trace
spanish_agent = Agent(name="spanish_agent", instructions="You translate the user's message to Spanish")
translation_picker = Agent(name="translation_picker", instructions="You pick the best Spanish translation.")
async def main():
msg = "Good morning!"
with trace("Parallel translation"):
res_1, res_2, res_3 = await asyncio.gather(
Runner.run(spanish_agent, msg),
Runner.run(spanish_agent, msg),
Runner.run(spanish_agent, msg),
)
outputs = [
ItemHelpers.text_message_outputs(res_1.new_items),
ItemHelpers.text_message_outputs(res_2.new_items),
ItemHelpers.text_message_outputs(res_3.new_items),
]
combined = "\n\n".join(f"Translation {i+1}: {o}" for i, o in enumerate(outputs))
best = await Runner.run(translation_picker, combined)
print(best.final_output)
asyncio.run(main())
Key notes
- Each
Runner.run()is independent; they share no state unless you explicitly pass a shared context - Wrap in
trace()to group all parallel runs under one workflow trace ItemHelpers.text_message_outputs(result.new_items)extracts the text from new output items- Useful for latency reduction when subtasks are independent (e.g., fan-out then fan-in)
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.