Lagent is a lightweight framework designed to facilitate the creation of LLM-based agents. Inspired by PyTorch, Lagent aims to provide a clear and intuitive workflow for building multi-agent applications.
Key Features:
- Agent Communication: Utilizes
AgentMessage
for seamless communication between agents. - Memory Management: Incorporates memory within agents to maintain state across interactions. Input and output messages are automatically added to the agent's memory.
- Customizable Aggregation: Offers
DefaultAggregator
for convertingAgentMessage
to OpenAI message format, with the option to implement custom aggregators for specific use cases. - Flexible Response Formatting: Supports flexible response formatting through output parsers, allowing structured extraction of information from model outputs.
- Tool Calling Consistency: Ensures consistency in tool calling through
ActionExecutor
, which requires inputAgentMessage
to contain tool name and parameters. - Dual Interfaces: Provides both synchronous and asynchronous interfaces for LLMs, actions, and action executors, enabling optimized performance for debugging and large-scale inference.
Use Cases:
- Math Agents: Solving mathematical problems using Python code execution.
- Blogging Agents: Improving writing quality through self-refinement workflows.
- Data Visualization Agents: Performing information retrieval, data collection, and chart plotting for data analysis and presentation.