DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to build a two agent teacher and student loop with Langroid

Use ChatAgent and Task to make one agent ask questions and another answer, as in the README glimpse.

Short answer: Install with pip install langroid; then configure the LLM with lm.OpenAIGPTConfig, as in the README; create a teacher ChatAgent and a student ChatAgent. All steps.

  • Top pick
  • Software and DevOps
  • Intermediate
  • 30 minutes
  • From the README
  • Claude Code
  • Codex
  • Cursor
  • Gemini CLI

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

  1. Install with pip install langroid
  2. Configure the LLM with lm.OpenAIGPTConfig, as in the README
  3. Create a teacher ChatAgent and a student ChatAgent
  4. Wrap each in a Task and add the student task as a sub task of the teacher
  5. 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

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer