Skip to main content

A modular, lightweight, and production-ready Agentic AI framework.

Project description

apexagents

apexagents is a modular, lightweight, and production-ready Agentic AI framework inspired by minimal agent architectures. It helps developers build LLM-powered agents that can utilize tools, retain conversation memory, and cleanly integrate with external resources like MCP servers.

Features

  • LLM Agnostic: Powered by litellm, supporting 100+ LLM providers.
  • Tool Calling: A clean @tool decorator to turn any Python function into an agent capability.
  • Memory Management: Pluggable memory backends (In-Memory, SQLite) with intelligent summarization.
  • MCP Native: First-class support for the Model Context Protocol (MCP) to connect with external tool servers.
  • Asynchronous: Built with async support for modern streaming and non-blocking LLM calls.

Installation

pip install apexagents

Quickstart

import asyncio
from apexagents import Agent, tool

@tool
def calculate_sum(a: int, b: int) -> int:
    """Calculates the sum of two integers."""
    return a + b

async def main():
    agent = Agent(
        name="MathBot",
        model="gpt-4o-mini",
        instructions="You are a helpful math assistant. Use tools for calculations.",
        tools=[calculate_sum]
    )
    
    response = await agent.arun("Can you add 256 and 512 for me?")
    print(response)

if __name__ == "__main__":
    asyncio.run(main())

Core Capabilities

1. Advanced Memory Management

apexagents supports persistent memory out-of-the-box. You can use SQLiteMemory for persistence and SummarizingMemory to handle context window limits.

from apexagents.memory import SQLiteMemory, SummarizingMemory

# Persistent SQLite backend
sqlite_memory = SQLiteMemory(db_path="agent_memory.db", session_id="user_1")

# Wrap with summarization to keep context lean
memory = SummarizingMemory(
    backend=sqlite_memory,
    max_messages=10,
    summarize_down_to=3
)

agent = Agent(..., memory=memory)

2. MCP Integration (Model Context Protocol)

Connect your agents to standard MCP servers to dynamically fetch tools.

from apexagents import Agent, MCPServerClient

async def main():
    # Connect to a local MCP server
    mcp_client = MCPServerClient(command="npx", args=["-y", "@modelcontextprotocol/server-fetch"])
    await mcp_client.connect()
    
    # Get tools from the server
    external_tools = await mcp_client.get_tools()
    
    agent = Agent(
        model="gpt-4o",
        tools=external_tools
    )
    
    await agent.arun("Fetch the contents of https://example.com")
    await mcp_client.close()

Environment Variables

The framework uses litellm under the hood. Ensure you set the relevant API keys for your provider:

  • OPENAI_API_KEY
  • ANTHROPIC_API_KEY
  • AZURE_API_KEY, AZURE_API_BASE, AZURE_API_VERSION

License

MIT

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

apexagents-1.0.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

apexagents-1.0.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file apexagents-1.0.0.tar.gz.

File metadata

  • Download URL: apexagents-1.0.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for apexagents-1.0.0.tar.gz
Algorithm Hash digest
SHA256 362bfc84b10cc1ea969b8d8efa475fd400f52b5c69f04102f0945b11b5e12b39
MD5 e58f3730270b26d5cff1da0fd6f9458d
BLAKE2b-256 5b3db389f945363d182eddc18b51ffe9cb2a2155189aab77442546038f00b628

See more details on using hashes here.

File details

Details for the file apexagents-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: apexagents-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for apexagents-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e40256dadef5665f532ec1d9eced63358735a16390ae602a12ce4c4f96082426
MD5 85677652f2697f7e87a856e36bc35d67
BLAKE2b-256 d47431ac1eb19dd528ab9622ece38c0bf586f88fc0fce5199162a82579603777

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