Skip to main content

agent framework designed to make AI agent development simple

Project description

EzyAgent: A Modern, Simple, and Powerful BaseAgent 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 BaseAgent

# Create an agent in one line
agent = BaseAgent("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 BaseAgent() 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 BaseAgent() 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 = BaseAgent(provider="openai")
agent = BaseAgent(provider="anthropic")
agent = BaseAgent(provider="ollama")

# Multiple providers with fallback
agent = BaseAgent(
    providers=["anthropic", "openai"],
    fallback_strategy="sequential"
)

# Custom provider configuration
agent = BaseAgent(
    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/
โ”‚   โ”œโ”€โ”€ baseagent.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 BaseAgent

# Create an agent
agent = BaseAgent("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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ezyagent-0.0.9.tar.gz (29.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ezyagent-0.0.9-py3-none-any.whl (41.7 kB view details)

Uploaded Python 3

File details

Details for the file ezyagent-0.0.9.tar.gz.

File metadata

  • Download URL: ezyagent-0.0.9.tar.gz
  • Upload date:
  • Size: 29.0 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

Hashes for ezyagent-0.0.9.tar.gz
Algorithm Hash digest
SHA256 96e47e71d9ef4c4529d2941df12aaa4c7f43a0e961da9046dc7705a8748d923d
MD5 a6c6902995ae86836170d0ae18434818
BLAKE2b-256 d5b3735f1041bf22ac37c024b38adb1ba42a3d3f04decd45f8731063e723c163

See more details on using hashes here.

File details

Details for the file ezyagent-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: ezyagent-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 41.7 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

Hashes for ezyagent-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 a606a2f268b2a15afb06f612155030afff2b4b4c8381f858cf22789e8ddc71fb
MD5 e5a6e2ed9f093573ef29e86116b3c859
BLAKE2b-256 c08f5da1a51a80468783d921b5306ff8ff93ee751689655f7b8bf45f7f5cb987

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page