agent framework designed to make AI agent development simple
Project description
EzyAgent: A Modern, Simple, and Powerful Agent Framework
Overview
EzyAgent is a next-generation agent framework designed to make AI agent development simple, observable, and reliable. By learning from the limitations of existing frameworks, we've created a solution that prioritizes developer experience while providing enterprise-grade features.
๐ Key Features
Simple Yet Powerful
from ezyagentsdf import Agent
# Create an agent in one line
agent = Agent("gpt-4")
# Start chatting
response = await agent.chat("Explain quantum computing")
# Add tools easily
@agent.tool
async def search(query: str) -> str:
"""Search the web."""
return await web_search(query)
First-Class Async Support
# Stream responses
async with Agent() as agent:
async for message in agent.stream_chat("Write a long story"):
print(message)
# Parallel operations
async def process_queries(queries: List[str]):
async with Agent() as agent:
tasks = [agent.chat(q) for q in queries]
responses = await asyncio.gather(*tasks)
Advanced Logging & Observability
# Comprehensive logging setup
agent.logger.configure(
format="json",
outputs={
"console": {"level": "INFO"},
"file": {
"path": "agent.log",
"level": "DEBUG"
},
"cloudwatch": {
"group": "agents",
"stream": "production"
}
},
metrics=["tokens", "latency", "costs"],
trace_requests=True
)
# Access logs and metrics
print(agent.logger.get_metrics())
print(agent.logger.get_recent_traces())
Robust Error Handling
try:
response = await agent.chat("Complex query")
except AgentError as e:
print(f"Error Type: {e.error_type}")
print(f"Provider Error: {e.provider_error}")
print(f"Context: {e.context}")
print(f"How to fix: {e.remediation}")
print(f"Debug trace: {e.debug_info}")
Intelligent State Management
# Built-in memory and state management
agent.memory.save_state("user_preferences", preferences)
agent.memory.add_context("User is a developer")
# Access conversation history
history = agent.memory.get_chat_history()
context = agent.memory.get_relevant_context("query")
# Persistent storage
await agent.memory.save_to_disk("agent_state.json")
await agent.memory.load_from_disk("agent_state.json")
Universal Provider Support
# Easy provider switching
agent = Agent(provider="openai")
agent = Agent(provider="anthropic")
agent = Agent(provider="ollama")
# Multiple providers with fallback
agent = Agent(
providers=["anthropic", "openai"],
fallback_strategy="sequential"
)
# Custom provider configuration
agent = Agent(
provider="openai",
config={
"max_retries": 3,
"timeout": 30,
"rate_limit": 100
}
)
Why EzyAgent?
Problems with Existing Frameworks
1. Langchain
- โ Complex setup and steep learning curve
- โ Confusing abstractions
- โ Poor error handling
- โ Limited async support
- โ Extensive tool ecosystem
- โ Good documentation
2. AutoGen
- โ Complex configuration
- โ Limited logging
- โ Difficult debugging
- โ Good multi-agent support
- โ Built-in caching
3. Pydantic-AI
- โ Limited provider support
- โ Basic logging
- โ No state management
- โ Strong type validation
- โ Clean data structures
4. LlamaIndex
- โ Complex for simple uses
- โ Heavy resource usage
- โ Confusing documentation
- โ Great RAG support
- โ Good data ingestion
5. PhiData
- โ Limited features
- โ Basic logging
- โ Limited providers
- โ Simple API
- โ Clean implementation
EzyAgent's Solutions
1. Development Experience
- One-line setup
- Clear, concise API
- Comprehensive documentation
- Type hints everywhere
- Informative error messages
- IDE autocomplete support
2. Observability
- Structured logging
- Request tracing
- Cost tracking
- Performance metrics
- Debug mode
- Custom metric support
3. Reliability
- Automatic retries
- Smart rate limiting
- Provider fallbacks
- Error recovery strategies
- Validation checks
4. Flexibility
- Easy extension
- Custom tools
- Provider agnostic
- State management
- Memory systems
- Custom implementations
5. Performance
- Async by default
- Efficient resource usage
- Built-in caching
- Streaming support
- Parallel operations
Architecture
ezyagent/
โโโ core/
โ โโโ agent.py # Base agent classes
โ โโโ memory.py # State management
โ โโโ tools.py # Tool management
โ โโโ providers/ # LLM providers
โโโ logging/
โ โโโ logger.py # Logging core
โ โโโ formatters.py # Log formatters
โ โโโ handlers.py # Output handlers
โ โโโ monitors.py # Metrics
โโโ utils/
โ โโโ errors.py # Error handling
โ โโโ validation.py # Input validation
โ โโโ helpers.py # Utilities
โโโ examples/ # Usage examples
Installation
pip install ezyagent
Quick Start
from ezyagentsdf import Agent
# Create an agent
agent = Agent("gpt-4")
# Enable logging
agent.logger.configure(format="json", outputs=["console"])
# Add a tool
@agent.tool
async def search(query: str) -> str:
"""Search the web."""
return await web_search(query)
# Chat with the agent
async def main():
response = await agent.chat("Find recent news about AI")
print(response)
# Run
asyncio.run(main())
Documentation
Full documentation is available at docs.ezyagent.dev
License
MIT License - feel free to use in your own projects!
Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
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 ezyagent-0.0.3.tar.gz.
File metadata
- Download URL: ezyagent-0.0.3.tar.gz
- Upload date:
- Size: 26.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.11.0rc1 Linux/6.8.0-49-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdf1f1bbae7870fd740fe1750f93d8bf81d7e990eeb41601a08dcc81d1230a0d
|
|
| MD5 |
f6bbe4667ae17449f84590d0bbcdbb87
|
|
| BLAKE2b-256 |
0b7fb89a78d9b431f5ad79b92b0f8e27205e3b1b1274d246f3d7ff44d979e890
|
File details
Details for the file ezyagent-0.0.3-py3-none-any.whl.
File metadata
- Download URL: ezyagent-0.0.3-py3-none-any.whl
- Upload date:
- Size: 39.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.11.0rc1 Linux/6.8.0-49-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57e31a76117557a90d18a651fee47e749d4aa7c7a7a2ccc694085661894be3ca
|
|
| MD5 |
4da77a76c0e02b2f00c358df6ddce69b
|
|
| BLAKE2b-256 |
4d8ee965651df5b43ce7262d3ea1479955e8bfd888e9b2697f4b5646b2f75150
|