{
 "schema_version": 1,
 "generated": "2026-11-09",
 "id": "langroid-langroid--build-a-two-agent-chat-loop-with-langroid",
 "repo": "langroid/langroid",
 "repo_url": "https://github.com/langroid/langroid",
 "repo_slug": "langroid-langroid",
 "title": "Build a two agent teacher and student loop",
 "page_title": "How to build a two agent teacher and student loop with Langroid",
 "summary": "Use ChatAgent and Task to make one agent ask questions and another answer, as in the README glimpse.",
 "who": "A developer learning multi agent patterns.",
 "problem": "Multi agent code often becomes tangled message passing.",
 "outcome": "Two agents talking in a loop, with you able to watch or join.",
 "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"
 ],
 "agent_prompt": "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>.",
 "agents": [
  "claude-code",
  "codex",
  "cursor",
  "gemini-cli"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "Loops between agents can run many LLM turns; set limits on the task.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "python",
 "requirements": [
  "Python with pip",
  "An OpenAI compatible LLM endpoint or API key"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "cost",
   "notice": "Each agent turn is an LLM call on your account."
  }
 ],
 "best": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/langroid-langroid/build-a-two-agent-chat-loop-with-langroid/",
 "md": "https://dedupedai.com/use-cases/langroid-langroid/build-a-two-agent-chat-loop-with-langroid/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/langroid-langroid--build-a-two-agent-chat-loop-with-langroid.json",
 "api_version": "v1"
}
