Lagent is an open-source, lightweight agent framework developed by the InternLM team (Shanghai AI Laboratory). Its core goal is to let developers construct LLM-based agents with minimal boilerplate: the project claims an agent can be built in roughly 20 lines of Python. The framework is available on PyPI (`pip install lagent`) and released under the Apache 2.0 license. The framework is structured around three main components: agents (the reasoning loop implementations), llms (model adapters), and actions (tool integrations). Supported agent paradigms include ReAct (Reason+Act), AutoGPT-style planning, and ReWOO (Reasoning WithOut Observation). Each component ships both a synchronous and an asynchronous variant, with the async path recommended for large-scale parallel inference workloads. Lagent ships built-in actions for common tools including a Python code interpreter, a Google Search tool, and generic API-call wrappers. It supports a range of LLM backends: OpenAI-compatible APIs (GPT-3.5/4), HuggingFace Transformers models, LMDeploy-accelerated models, and InternLM's own model family. Model switching is designed to be seamless across backends. The framework also underpins InternLM's own MindSearch project, a multi-agent web search engine that was refactored onto Lagent v0.5 for improved concurrency. This real-world usage demonstrates the framework's ability to support multi-agent orchestration beyond single-agent loops. Official documentation is maintained at lagent.readthedocs.io with full API coverage. As of early 2025 the project released v0.5.0 release candidates (rc1 through rc3 between November 2024 and March 2025), indicating active development. The stable series reached v0.2.4 in October 2024. The project is targeted at researchers and developers who want a simple, extensible Python library for agent experimentation without the overhead of heavier frameworks. Key features: - Supports ReAct, AutoGPT, and ReWOO agent paradigms out of the box - Dual synchronous/asynchronous interface for every component (agents, LLMs, actions) - Built-in actions: Python interpreter, Google Search, and generic API call tool - Flexible LLM backend support: OpenAI API, HuggingFace Transformers, LMDeploy, InternLM models - Minimal boilerplate - agents constructible in ~20 lines of Python - Apache 2.0 open-source license, installable via pip - Powers InternLM MindSearch multi-agent web search system - Full API documentation at lagent.readthedocs.io
Free and open-source (Apache 2.0)
