Dev & Engineering pythonmulti-agenttool-usevllmopenai-apilmdeployweb-search

Lagent Lightweight Agent Framework

A lightweight framework for building LLM-based agents, inspired by PyTorch's design philosophy.

FollowAgents review · FARS-2.1
Not recommended
43/ 100 5-point scale 2.2 / 5
1 2 3 4 5 6
1Trust5 / 29 · 0.9/5

Evidence shows the framework provides hook mechanisms (e.g., CodeProcessor) allowing message modification before/after actions, but least privilege is not enforced; default actions like IPythonInteractive can execute arbitrary code, which is excessive. User confirmation mechanism is absent; tool calls execute automatically. Data flow transparency is partial: AgentMessage structure is clear, but it is not explained how data is processed by external services. Sensitive data handling is not mentioned. Dependency security is not assessed; requirements.txt only lists files without version pinning or vulnerability scanning. External effects: actions like WebBrowser can make network requests, but no sandbox or restrictions are provided. Rollback mechanism is not mentioned. Source attribution: README and citation provide author info, but publisher is unverified.

2Reliability8 / 14 · 2.9/5

Self-consistency: README examples are consistent with API docs, but not verified by execution. Dependency availability: dependencies are not version-pinned, which may affect reproducibility. Failure messages: tests cover API errors and timeouts, but not all scenarios.

3Adaptability12 / 18 · 3.3/5

Audience and scenarios: README provides single-agent and multi-agent examples covering various scenarios. Capability boundaries: documentation explains tool calling and async interfaces, but does not specify limitations. Trigger precision: tool invocation format is clear, but not verified. Environment fit: supports sync and async, but does not specify all environment requirements.

4Convention8 / 18 · 2.2/5

Information architecture: README is well-structured with TOC and examples. Install notes: provides source installation command. Naming stability: API naming is consistent, but no version history. Examples and FAQ: rich examples, but no FAQ. Known limitations: not mentioned. License: Apache-2.0 complete. Versioning changelog: not provided. Maintenance responsibility: contributor info exists, but no explicit maintenance policy.

5Effectiveness7 / 13 · 2.7/5

Output usability: example outputs are clear, but not verified. Marginal value: provides multi-agent framework with unique value. Cost-benefit: no performance or resource consumption data.

6Verifiability3 / 8 · 1.9/5

Claim traceability: README examples can be traced to code, but not verified. Cross-source corroboration: no external verification. Fact-inference separation: examples and inferences are mixed, not clearly separated.

Evidence confidence: Low Reviewed Aug 09, 2026 Reviewed revision 0ab2e2f55047
Safety controls not found in source: confirmation before acting, sensitive-data handling, dependency security, rollback or recovery path
Before you use it
  • Default actions like IPythonInteractive can execute arbitrary code, posing security risks; consider restricting permissions or adding user confirmation.
  • Dependencies are not version-pinned, which may introduce incompatibilities or vulnerabilities; consider locking versions and regular scanning.
  • Known limitations and changelog are not provided, making it hard for users to assess risks.
Review evidence [1][2][3][4][5][6][7]
See the full review method →

What does this agent do, and when should you use it?

Lagent is a lightweight framework for building LLM-based agents, inspired by PyTorch's design philosophy of layers and message passing. It provides an Agent class that communicates via AgentMessage, enabling intuitive workflow construction. The framework supports various LLM backends (e.g., VllmModel, GPTAPI, AsyncGPTAPI) and tools (e.g., IPythonInterpreter, WebBrowser), with synchronous and asynchronous interfaces. Key features include memory management, custom aggregators, flexible output formatting (ToolParser), and tool invocation via ActionExecutor. Installation is straightforward via pip, and examples cover math problem solving, multi-agent blogging, and data visualization. Licensed under Apache-2.0.

Lagent allows users to build agents by defining Agent instances and passing AgentMessage. It supports multiple LLM providers (e.g., VllmModel, GPTAPI) and integrates tools like IPythonInterpreter and WebBrowser. The core flow: Agent receives messages, maintains context via memory, formats messages using an aggregator, calls the LLM for a response, and optionally executes tool calls via ActionExecutor. It provides synchronous and asynchronous variants (e.g., AsyncAgent) and allows custom aggregators, output parsers, and hooks.

  1. Developers needing to quickly build an agent that solves math problems by writing and executing Python code.
  2. Teams aiming to implement multi-agent collaboration, such as a writer and critic improving a blog post.
  3. Researchers requiring web search, data collection, and chart plotting for a data-to-visualization pipeline.
  4. Projects needing a unified interface across multiple LLM providers.
  5. Developers wanting to leverage asynchronous execution for large-scale inference to maximize resource utilization.

What are this agent's strengths and limitations?

Pros
  • PyTorch-like design philosophy makes it easy to understand and extend.
  • Supports multiple LLM backends (Vllm, GPTAPI) and tools (IPython, WebBrowser).
  • Provides synchronous and asynchronous interfaces for different scale requirements.
  • Flexible aggregators and parsers allow customization of message formats and tool usage.
Limitations
  • Requires users to have some Python and LLM knowledge.
  • Documentation may be limited; users may need to rely on examples.
  • Depends on external LLM APIs or local model serving, requiring API keys or hardware resources.
  • Async usage requires ensuring component consistency, adding configuration complexity.

How do you install or deploy this agent?

Install from source:\n``bash\ngit clone https://github.com/InternLM/lagent.git\ncd lagent\npip install -e .\n``

How do you use this agent?

After installation, you can create an LLM instance (e.g., VllmModel) and an Agent, then pass user messages to get responses. For example:\n``python\nfrom lagent.llms import VllmModel\nfrom lagent.agents import Agent\nfrom lagent.schema import AgentMessage\n\nllm = VllmModel(path='Qwen/Qwen2-7B-Instruct')\nagent = Agent(llm)\nuser_msg = AgentMessage(sender='user', content='What is the weather today?')\nbot_msg = agent(user_msg)\nprint(bot_msg)\n``\nFor tool use, define an ActionExecutor with hooks to execute code.

How does this agent compare with similar options?

Similar to AutoGen and LangGraph, but Lagent is lighter and emphasizes a PyTorch-style design with more intuitive layer and message passing concepts.

FAQ

Does Lagent support local models?
Yes, Lagent supports local models via VllmModel, such as Qwen/Qwen2-7B-Instruct.
Can I customize tool calling?
Yes, you can implement custom tool calling by writing hooks and custom aggregators.
Does Lagent support multi-agent collaboration?
Yes, you can create multiple Agents and coordinate them via message passing, as shown in the blogging example.
What hardware is required to deploy Lagent?
It depends on the LLM backend. For local models, sufficient GPU memory is needed; for APIs, no local GPU is required.

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related agents