Back to directory

Lagent

A lightweight Python framework for building LLM-based agents, modeled on neural-network-style layers where agents pass typed messages and automatically record them to memory.

Lagent

Lagent is a lightweight framework for building agents backed by large language models. It borrows its design philosophy from PyTorch: agents are like neural network layers, and building a multi-agent application means creating those layers and defining how messages pass between them.

Agents communicate using a typed message object, and every message an agent sends or receives during a forward pass is added to that agent's memory automatically, which can be inspected or dumped to a dictionary. A default aggregator assembles memory and formats it for a chosen LLM's chat interface, such as the OpenAI message format, and custom aggregators can implement few-shot prompting or other assembly logic. A tool parser extracts structured tool calls, such as a code interpreter invocation, from a model's raw text output.

It is installed from source with pip and is licensed under Apache-2.0.

More in Agent frameworks

See all 902
  • Recurse

    recurse.run

    A serverless harness that lets a coding agent design, test, and deploy its own specialist sub-agents as tools, MCP servers, or bots, defined by a schema-validated manifest.

  • ProofForge

    shulgin.is-a.dev

    An AI-agent pipeline that decomposes a mathematics problem, proves each piece, and formalizes the result in Lean 4 and Mathlib until the Lean kernel accepts it, with six of its proofs already merged into Google DeepMind's formal-conjectures repository.

  • local-coder

    github.com

    Builds a local coding-agent team on top of Ollama and OpenCode by detecting the machine's hardware, recommending models for seven specialist roles, and testing whether each assigned model can actually use tools, edit a repository and pass verification.