A lightweight AI Agent framework built on LiteLLM with ReAct reasoning, tool calling, and smart memory.
Project description
EasyAgent
English | 简体中文
A lightweight AI Agent framework built on LiteLLM, featuring multi-model support, tool calling, and intelligent memory management.
~809 lines of code, production-ready Agent capabilities — Multi-model adapters, tool calling, smart memory, ReAct reasoning, DAG pipelines, debug tracing.
Features
- Multi-Model Support - Unified interface via LiteLLM for OpenAI, Anthropic, Gemini, and more
- Tool Calling - Protocol-based tool definition with
@register_tooldecorator - Memory - Sliding window + auto-summarization strategies for context management
- ReAct Loop - Standard think → act → observe reasoning cycle
- DAG Pipeline - Directed Acyclic Graph workflow orchestration with parallel execution
- Debug Friendly - Colored logging, token usage and cost tracking
Installation
pip install easy-agent-sdk
From source:
git clone https://github.com/SNHuan/EasyAgent.git
cd EasyAgent
pip install -e ".[dev]"
Quick Start
1. Configuration
Create a config file config.yaml:
debug: true
summary_model: gpt-4o-mini
models:
gpt-4o-mini:
api_type: openai
base_url: https://api.openai.com/v1
api_key: sk-xxx
Set environment variable:
export EA_DEFAULT_CONFIG=/path/to/config.yaml
2. Define Tools
from easyagent.tool import register_tool
@register_tool
class GetWeather:
name = "get_weather"
type = "function"
description = "Get the weather for a city."
parameters = {
"type": "object",
"properties": {"city": {"type": "string", "description": "City name"}},
"required": ["city"],
}
def init(self) -> None:
pass
def execute(self, city: str) -> str:
return f"The weather in {city} is sunny, 25°C."
3. Create Agent
import asyncio
from easyagent.agent import ReactAgent
from easyagent.config.base import ModelConfig
from easyagent.model.litellm_model import LiteLLMModel
config = ModelConfig.load()
model = LiteLLMModel(**config.get_model("gpt-4o-mini"))
agent = ReactAgent(
model=model,
tools=["get_weather"],
system_prompt="You are a helpful assistant.",
max_iterations=10,
)
result = asyncio.run(agent.run("What's the weather in Beijing?"))
print(result)
Core Components
Agent
| Class | Description |
|---|---|
ReactAgent |
ReAct loop: think → act → observe |
ToolAgent |
Tool registration and execution |
Memory
from easyagent.memory import SlidingWindowMemory, SummaryMemory
# Sliding window
memory = SlidingWindowMemory(max_messages=20, max_tokens=4000)
# Auto-summary for long tasks
memory = SummaryMemory(task_id="task_001", reserve_ratio=0.3)
Pipeline
DAG-based workflow with parallel execution:
import asyncio
from easyagent.pipeline.base import BaseNode, BasePipeline, NodeContext
class FetchData(BaseNode):
async def execute(self, ctx: NodeContext) -> None:
ctx.data = "raw_data"
class ProcessA(BaseNode):
async def execute(self, ctx: NodeContext) -> None:
ctx.result_a = f"{ctx.data}_A"
class ProcessB(BaseNode):
async def execute(self, ctx: NodeContext) -> None:
ctx.result_b = f"{ctx.data}_B"
fetch = FetchData()
process_a = ProcessA()
process_b = ProcessB()
fetch >> [process_a, process_b] # Parallel branches
pipeline = BasePipeline(root=fetch)
ctx = asyncio.run(pipeline.run())
Debug
from easyagent.debug.log import LogCollector, Logger
log = Logger("MyApp")
with LogCollector() as collector:
log.info("Step 1")
log.info("Step 2")
print(collector.to_text())
Project Structure
easyagent/
├── agent/ # ReactAgent, ToolAgent
├── model/ # LiteLLMModel, Message, ToolCall
├── memory/ # SlidingWindowMemory, SummaryMemory
├── tool/ # ToolManager, @register_tool
├── pipeline/ # BaseNode, BasePipeline
├── config/ # ModelConfig
├── prompt/ # Prompt templates
└── debug/ # Logger, LogCollector
License
MIT License © 2025 Yiran Peng
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file easy_agent_sdk-0.1.1.tar.gz.
File metadata
- Download URL: easy_agent_sdk-0.1.1.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8099a96c276aac290f36f2e06e9d7486fc17e5a2c5a556902a1f84bc87adb822
|
|
| MD5 |
c88b29e8bcfc1ba6bc759e0e450b0963
|
|
| BLAKE2b-256 |
899de56af23cd27cb6b89a0e734e3411f5c6e3e573be396569af61b3c80ceb8b
|
Provenance
The following attestation bundles were made for easy_agent_sdk-0.1.1.tar.gz:
Publisher:
publish.yml on SNHuan/EasyAgent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
easy_agent_sdk-0.1.1.tar.gz -
Subject digest:
8099a96c276aac290f36f2e06e9d7486fc17e5a2c5a556902a1f84bc87adb822 - Sigstore transparency entry: 828406922
- Sigstore integration time:
-
Permalink:
SNHuan/EasyAgent@27eb744a0deea14aed0facb53a2fd65e4cf78269 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/SNHuan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@27eb744a0deea14aed0facb53a2fd65e4cf78269 -
Trigger Event:
release
-
Statement type:
File details
Details for the file easy_agent_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: easy_agent_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 28.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c3a6aedf07fbedc9397f6141512faa54e02aeb4e4bed0b6798caafaacfeb8fc
|
|
| MD5 |
1ecb735ce9545c2486df6f1346cb5482
|
|
| BLAKE2b-256 |
ca3a8f5f4bae3ff9e3b7b5e5f2199f226a6888218e46fd12f9bf06ebaa73f2ed
|
Provenance
The following attestation bundles were made for easy_agent_sdk-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on SNHuan/EasyAgent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
easy_agent_sdk-0.1.1-py3-none-any.whl -
Subject digest:
5c3a6aedf07fbedc9397f6141512faa54e02aeb4e4bed0b6798caafaacfeb8fc - Sigstore transparency entry: 828406926
- Sigstore integration time:
-
Permalink:
SNHuan/EasyAgent@27eb744a0deea14aed0facb53a2fd65e4cf78269 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/SNHuan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@27eb744a0deea14aed0facb53a2fd65e4cf78269 -
Trigger Event:
release
-
Statement type: