cost. Each agent turn is an LLM call on your account.
Who it is forA developer learning multi agent patterns.
The problemMulti agent code often becomes tangled message passing.
The outcomeTwo agents talking in a loop, with you able to watch or join.
What you need first
- Python with pip
- An OpenAI compatible LLM endpoint or API key
Steps
- Install with
pip install langroid - Configure the LLM with lm.OpenAIGPTConfig, as in the README
- Create a teacher ChatAgent and a student ChatAgent
- Wrap each in a Task and add the student task as a sub task of the teacher
- Run the teacher task
Prompt for your agent
Using langroid/langroid, install `pip install langroid` and write a script based on the README's 2 agent chat loop where a teacher agent quizzes a student agent about <my topic>.
Caveat. Loops between agents can run many LLM turns; set limits on the task.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for langroid/langroid and "Build a two agent teacher and student loop"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer