What is Langroid?
Langroid is a lightweight Python framework for building LLM-powered applications out of collaborating agents. It sits in the Multi-Agent Systems category of the Agents & Automation tools and is open-source, written in Python and licensed MIT. To get started: install Langroid.
Overview
Langroid is a lightweight Python framework for building LLM-powered applications out of collaborating agents. You set up Agents, equip each with optional components — an LLM, a vector store, tools and functions — assign them tasks, and let them solve a problem by exchanging messages. The project describes this multi-agent paradigm as inspired by the Actor model, though you do not need to know anything about that to use it.
Its defining design decision is what it leaves out: Langroid does not use LangChain or any other LLM framework underneath, and it works with practically any LLM behind an OpenAI-compatible API, including local models served through Ollama. The two core abstractions are small — `ChatAgent` holds an agent's configuration and conversation state, and `Task` wraps an agent in a loop that can talk to a user or to other agents' tasks via `add_sub_task`.
The framework comes out of CMU and UW-Madison researchers and ships a set of specialised agents beyond plain chat: `DocChatAgent` for retrieval-augmented question answering, `SQLChatAgent` and `TableChatAgent` for querying databases and dataframes in natural language, `Neo4jChatAgent` for knowledge graphs, and structured information extraction. It also adapts MCP servers' tools into Langroid `ToolMessage` instances, so an agent can call them like any other tool.
What it does
- Agent + Task abstractions: wrap an agent in a task, then compose tasks into multi-agent loops with `add_sub_task`
- No LangChain or other framework dependency underneath — works with practically any LLM via an OpenAI-compatible API, local or hosted
- Specialised agents included: DocChatAgent (RAG), SQLChatAgent, TableChatAgent, Neo4jChatAgent and structured information extraction
- MCP tool adapter that converts an MCP server's tools into Langroid ToolMessage instances for any agent
- Conversation state maintained per agent, so follow-up turns keep context without manual history plumbing
- Optional extras for document chat, vector stores and databases, installed only when you need them
Getting started
Langroid installs from PyPI as a small core with optional extras. Set the API key for whichever provider you point it at, then build up from a bare LLM call to a two-agent loop.
Install Langroid
Install the core package, then add extras only for the parts you use — document chat, databases, or local Hugging Face embeddings.
pip install langroid
# optional extras
pip install "langroid[doc-chat]"
pip install "langroid[db]"
pip install "langroid[hf-embeddings]"
pip install "langroid[all]"Configure a model and call it directly
`OpenAIGPTConfig` points at any model served behind an OpenAI-compatible API — a hosted model, or a local one such as `ollama/mistral`.
import langroid as lr
import langroid.language_models as lm
llm_cfg = lm.OpenAIGPTConfig(
# any model served via an OpenAI-compatible API
chat_model=lm.OpenAIChatModel.GPT4o, # or, e.g., "ollama/mistral"
)
mdl = lm.OpenAIGPT(llm_cfg)
response = mdl.chat("What is the capital of Ontario?", max_tokens=10)Wrap the model in an Agent, then a Task
A `ChatAgent` keeps conversation state across calls; wrapping it in a `Task` runs the interactive loop with a user or another agent.
agent_cfg = lr.ChatAgentConfig(llm=llm_cfg)
agent = lr.ChatAgent(agent_cfg)
agent.llm_response("What is the capital of China?")
response = agent.llm_response("And India?") # maintains conversation state
task = lr.Task(agent, name="Bot", system_message="You are a helpful assistant")
task.run("Hello") # kick off with user saying "Hello"Compose two agents into a loop
Give each agent its own task and system message, then attach one as a sub-task. Here a Teacher asks questions and a single-round Student answers them.
teacher_agent = lr.ChatAgent(agent_cfg)
teacher_task = lr.Task(
teacher_agent, name="Teacher",
system_message="""
Ask your student concise numbers questions, and give feedback.
Start with a question.
"""
)
student_agent = lr.ChatAgent(agent_cfg)
student_task = lr.Task(
student_agent, name="Student",
system_message="Concisely answer the teacher's questions.",
single_round=True,
)
teacher_task.add_sub_task(student_task)
teacher_task.run()Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Reach for it when you want explicit multi-agent structure — a reviewer agent checking a writer agent, or a planner delegating to workers — rather than one prompt doing everything
- Reach for it to build document question answering with DocChatAgent instead of assembling a retrieval pipeline by hand
- Reach for it to put natural language in front of a SQL database, a dataframe or a Neo4j graph via the specialised chat agents
- Reach for it when you want to stay off the larger frameworks and keep the option of swapping in a local model behind an OpenAI-compatible endpoint
How Langroid compares
Langroid alongside other open-source multi-agent systems tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Paperclip | ★ 118k | A self-hosted control plane that runs a team of AI agents like a company, with an org chart, tasks, budgets and approvals. |
| Ruflo | ★ 82.7k | Agent meta-harness that wraps Claude Code and Codex with 100+ specialized agents, swarm coordination, vector memory, background workers and cross-machine agent federation. |
| MetaGPT | ★ 71.5k | A multi-agent framework that models a software company, assigning roles like product manager, architect, and engineer to generate code from a single prompt. |
| AutoGen | ★ 62k | Microsoft Research's framework for building applications where multiple agents converse with each other and with tools to solve tasks. |
| CrewAI | ★ 61.4k | A framework for assembling teams ('crews') of role-playing agents that divide tasks and collaborate to complete a goal. |
| AgentScope | ★ 36.9k | A framework for building multi-agent applications with message passing, visual debugging tools, and distributed execution. |
| OpenAI Agents SDK | ★ 30.9k | OpenAI's lightweight Python SDK for building multi-agent workflows using explicit handoffs, tools, and guardrails. |
| Langroid | ★ 4.2k | Multi-agent LLM programming in Python, without LangChain underneath |
