Skip to content
AgentAgent framework

lagent

Python framework for building LLM agents and multi-agent workflows with tool use

lagent is an open-source agent framework for multi-agent frameworks. It is available on API, Linux, macOS, Windows and Self-hosted.

Pricing
Open source
Platforms
API, Linux, macOS
GitHub stars
2.3K
Last commit
Language
Python
License
Apache-2.0

Similar agents

About lagent

Lagent is an open-source Python library for assembling large language model agents. It treats agents like layers in a neural network: you create components and define how messages pass between them, which keeps multi-step workflows readable and easy to reason about.

Each agent keeps a session-scoped memory of its messages, can parse model output into structured fields such as tool calls, and routes those calls through an action executor. Tools such as an IPython interpreter and a web browser are included, and hooks let you convert messages before and after each action. Nearly every component has an asynchronous variant, so the same design can be used for debugging synchronously and for higher-throughput inference.

The project suits developers who want to build custom agents or multi-agent pipelines on top of local or hosted models rather than use a finished end-user app. Examples in the repository cover a single coding agent, a self-refining blogging pair, and a research-and-charting workflow.

What it does

Layer-style agent design
Agents are composed like neural network layers, with messages passed between components in plain Python.
Session-scoped memory
Each agent stores its conversation history per session ID, with methods to inspect, export and reset it.
Tool execution
An action executor runs tool calls, including a Python interpreter and a web browser, and returns results to the agent.
Custom output parsing
Parsers extract tool invocations or other structured fields from raw model responses.
Message hooks
Hooks let developers transform messages before agents run or before and after actions execute.
Synchronous and asynchronous variants
Most components have async counterparts for large-scale concurrent inference.

Good for

  • Prototyping a single agent that writes and runs Python code to solve math problems
  • Coordinating several agents that draft, critique and revise written content
  • Building a pipeline that gathers web data and produces charts automatically
  • Running agents against locally hosted open models via vLLM or LMDeploy

Pricing

Open source

Free, open-source under Apache 2.0.

lagent FAQ

What license is Lagent released under?

Lagent is released under the Apache 2.0 license.

How do I install lagent?

Clone the repository and run pip install -e . from the project directory.

Which models can lagent use?

The examples show vLLM, LMDeploy, GPT-style APIs and InternLM-formatted models.

Is lagent free?

Yes. lagent is open source, so you can use and self-host it for free.

What are the best alternatives to lagent?

The closest alternatives to lagent are llm_agents, smolagents, AgentVerse, llama-agents and agentic-context-engine.

Where this comes from

  • Description: written from the project's README.