Langroid
TL;DR
Langroid is an MIT-licensed Python framework for multi-agent LLM apps, started by researchers from CMU and UW-Madison and built without LangChain. Agents are wrapped in Tasks that delegate to sub-tasks, tools are Pydantic classes usable with any LLM, and MCP servers plug in as tools. It suits developers wanting explicit message-passing agent programs.
Key facts
| Type | Framework |
|---|---|
| Languages / SDKs | Python |
| License | MIT |
| Pricing model | Open source, free |
| Orchestration pattern | Supervisor |
| GitHub stars | 4,109 (as of 2026-09-30) |
| GitHub forks | 408 |
| Last push | 2026-09-29 |
| Latest release | 0.68.1 |
| Repository | langroid/langroid |
| Website | langroid.github.io |
| Documentation | langroid.github.io |
| Last verified | 2026-09-30 |
Key features
- A Task wraps an agent and cycles through its three responders (LLM, agent tool handling, user), with termination settings such as single_round and turn limits. (source)
- Hierarchical delegation: sub-tasks added with add_sub_task act as extra responders that the parent task tries in turn. (source)
- ToolMessage tools are Pydantic classes that work with any LLM, not only models with native function calling; validation errors go back to the LLM for a retry. (source)
- An MCP adapter turns MCP server tools into ToolMessage classes, over stdio (npx, uvx, generic) or an in-memory FastMCP server, including an @mcp_tool decorator. (source)
- DocChatAgent does retrieval-augmented chat over documents with vector stores such as Qdrant, Chroma and LanceDB, and cites sources. (source)
- Task budgets and done conditions (turns, cost, tokens, time) end runs predictably. (source)
- Local and non-OpenAI models are used through OpenAI-compatible servers such as Ollama or LiteLLM, named like ollama/mistral. (source)
Architecture and orchestration pattern
Pattern: Supervisor
Langroid follows an actor-style design: agents exchange messages, and each ChatAgent holds its own conversation state plus optional tools and a vector store. An agent has three responders, one each for the LLM, the agent's own tool handling, and the human user.
A Task wraps an agent with a system message and runs a loop over those responders until a done condition is met. Multi-agent systems are built by nesting: parent.add_sub_task(child) makes the child task another responder of the parent, tried in round-robin order after the agent's own responders. Because Task.run() has the same shape as a responder, delegation can be recursive, giving a tree of tasks rather than a flat group chat.
Memory is the agent's message history, with retrieval from vector stores (Qdrant, Chroma, LanceDB, Pinecone, PGVector, Weaviate) for document agents and optional Redis caching of LLM responses. Logs record message lineage so a reply can be traced to its origin.
Human in the loop
The human is built into the loop as one of the three responders. By default a Task is interactive=True and waits for keyboard input after each non-human response. With interactive=False it runs unattended, except that an agent can still ask the person directly by addressing @user or using RecipientTool, and default_human_response can script replies for tests. No web-based approval UI is part of the core library.
Harnesses it can drive
- Claude Code (evidence)
Protocols
| Protocol | Support | Note |
|---|---|---|
| MCP | Yes evidence | Client: the MCP tool adapter connects to MCP servers (stdio or in-memory FastMCP) and converts their tools into Langroid ToolMessage classes. |
| A2A | Unknown | Searched README, docs site, GitHub code search and issues for a2a / agent2agent; nothing found. |
| AG-UI | Partial evidence | A Langroid integration lives in the AG-UI repository and is listed under Community in the AG-UI README; Langroid's own README and docs do not mention AG-UI. |
Best for
- Python developers who want multi-agent programs built from explicit Agent and Task objects rather than a graph DSL.
- Document question answering and structured extraction with DocChatAgent and tool-calling sub-agents.
- Running on local models through Ollama or other OpenAI-compatible servers, including tools on models without native function calling.
- Claude Code users who want the official plugin to generate Langroid code from recorded patterns.
Not for
- Teams that need a TypeScript, Java or .NET SDK.
- Projects that need native Anthropic or OpenAI Responses API clients today; both are open issues.
- Users who want A2A interoperability; no A2A support was found.
Quickstart
pip install langroid import langroid as lr
import langroid.language_models as lm
# Any OpenAI-compatible model works, e.g. chat_model="ollama/mistral" for a local one.
cfg = lr.ChatAgentConfig(llm=lm.OpenAIGPTConfig(chat_model=lm.OpenAIChatModel.GPT4o))
teacher = lr.Task(
lr.ChatAgent(cfg), name="Teacher", interactive=False,
system_message="Ask your student three short sums, one at a time. "
"After checking the third answer, reply DONE.",
)
student = lr.Task(
lr.ChatAgent(cfg), name="Student", interactive=False, single_round=True,
system_message="Answer each question with only the number.",
)
teacher.add_sub_task(student)
result = teacher.run(turns=20)
Common pitfalls
- The README asks for Python 3.11+; the package metadata allows >=3.10 and <3.14.
- Put
OPENAI_API_KEY(or other provider settings) in a.envfile; non-OpenAI models go through OpenAI-compatible servers or LiteLLM. - Tasks default to
interactive=Trueand wait for keyboard input after each agent reply; passinteractive=Falsefor scripted runs. - Features need extras:
langroid[doc-chat],langroid[db],langroid[hf-embeddings]orlangroid[all]. ForSQLChatAgenton Postgres installlangroid[postgres](orpsycopg2-binaryif that fails). - The README suggests reinstalling
mysqlclientif you hit odd errors with it.
Pros
- Tool calls work with models that lack native function calling, because ToolMessage is parsed from ordinary output and validated with Pydantic. (source)
- Delegation is plain composition of Task objects, so the same pattern scales from two agents to nested trees. (source)
- Explicit run budgets (turns, cost, tokens, time) and loop detection help stop runaway agent loops. (source)
- Official Claude Code plugin with skills for writing and recording Langroid patterns. (source)
- Regular releases in 2026 (0.68.1 on 23 September 2026). (source)
Cons
- No native Anthropic API client; Anthropic models go through LiteLLM, and native support is an open issue. (source)
- OpenAI's Responses API is not implemented yet (open issue since August 2025). (source)
- The architecture overview in the docs is still labelled a preliminary work in progress. (source)
- AG-UI support exists only as a community integration maintained in the AG-UI repository. (source)
- Still pre-1.0 (0.68.x), with several releases per month. (source)
Alternatives
FAQ
Does Langroid support MCP?
Yes, as a client. Its MCP adapter turns tools from MCP servers into Langroid ToolMessage classes. AG-UI works only through a community integration in the AG-UI repo, and no A2A support was found.
Is Langroid free?
Yes. It is MIT licensed and has no paid tier; you pay only for the model API you use, or nothing when running local models.
What language is Langroid written in?
Python only. The README asks for Python 3.11 or newer.
How do Langroid agents collaborate?
Each agent is wrapped in a Task, and tasks are nested with add_sub_task. A parent task treats its sub-tasks as extra responders and hands messages to them in turn, so delegation forms a tree.
Does Langroid work with Claude Code?
The project publishes a Claude Code plugin (langroid@langroid) whose skills help Claude Code write Langroid code and record new patterns. Langroid itself does not drive Claude Code.
Sources
- Langroid GitHub repository (README)
- Langroid documentation
- Quick start: setup
- README: Claude Code plugin
- Task reference
- Multi-agent task delegation
- Chat agent with tools
- MCP tools
- Chat agent with documents (DocChatAgent)
- Task termination
- Local LLM setup
- Overview of Langroid's multi-agent architecture (preliminary)
- Task source (interactive, default_human_response)
- AG-UI repository: Langroid integration
- AG-UI README (Community integrations list)
- Releases
- Issue #737: native Anthropic API support
- Issue #907: OpenAI Responses API