Skip to main content

Open-source orchestration framework for agentic AI systems with multi-agent coordination, tool integration, and workflow management

Project description

AgentCore - Production-Ready Agentic AI Framework

AgentCore is an open-source orchestration framework for building, training, and deploying intelligent agent systems at scale. Built on Google's A2A (Agent-to-Agent) protocol v0.2, it provides enterprise-grade infrastructure for multi-agent collaboration, automated prompt optimization, and cross-platform LLM integration.

Tests Coverage Python License


๐ŸŽฏ Key Features

๐Ÿค– Agent-to-Agent Protocol (A2A)

  • JSON-RPC 2.0 compliant API for standardized agent communication
  • Agent discovery via .well-known/agent.json endpoints
  • Task coordination with lifecycle management (create, assign, execute, complete)
  • Real-time messaging via WebSocket and Server-Sent Events (SSE)
  • Distributed tracing with A2A context propagation

๐Ÿง  DSPy Optimization Framework

  • Automated prompt optimization using MIPROv2, BootstrapFewShot, and GEPA algorithms
  • Continuous learning pipeline with online optimization and drift detection
  • A/B testing framework for prompt variant comparison
  • MLflow integration for experiment tracking and model versioning
  • Performance analytics with ROI tracking and improvement recommendations
  • GPU acceleration support for high-throughput optimization
  • Custom algorithm plugins for domain-specific optimization strategies

๐Ÿ”Œ LLM Gateway

  • Multi-provider support: OpenAI (GPT-5), Anthropic (Claude 4.5), Google (Gemini 2.5)
  • Intelligent routing with automatic failover and load balancing
  • Cost tracking and budget management
  • Rate limit handling with exponential backoff
  • Caching for duplicate request optimization
  • Model selection based on task requirements and constraints

๐ŸŽญ Agent Runtime

  • Chain-of-Thought (CoT) reasoning engine
  • Multi-tool integration with external API connectors
  • Memory management with context preservation
  • Error recovery and retry mechanisms
  • Bounded context for consistent agent behavior
  • State persistence and checkpointing

๐Ÿ“Š Orchestration & Workflows

  • Graph-based workflow planning with topological sorting
  • Event-driven architecture with 15k+ events/sec throughput
  • Parallel execution with automatic dependency resolution
  • Performance monitoring with Prometheus metrics
  • Health checks and circuit breakers

๐Ÿ” Security & Compliance

  • JWT authentication with role-based access control (RBAC)
  • PII detection and data anonymization
  • Audit logging for compliance tracking
  • Secure credential management via Kubernetes secrets
  • Network isolation with service mesh integration

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.12+
  • PostgreSQL 14+
  • Redis 7+
  • (Optional) MLflow server for experiment tracking
  • (Optional) GPU for accelerated optimization

Installation

# Clone the repository
git clone https://github.com/Mathews-Tom/AgentCore.git
cd AgentCore

# Install dependencies using uv
uv sync

# Set up environment variables
cp .env.test.template .env
# Edit .env with your configuration

Running with Docker Compose

# Start all services (PostgreSQL, Redis, AgentCore)
docker compose -f docker-compose.dev.yml up

# API available at http://localhost:8001
# API docs at http://localhost:8001/docs (DEBUG mode only)

Running Locally

# Start database and Redis
docker compose -f docker-compose.dev.yml up postgres redis

# Source environment variables
set -a && source .env && set +a

# Run migrations
uv run alembic upgrade head

# Start development server
uv run uvicorn agentcore.a2a_protocol.main:app --host 0.0.0.0 --port 8001 --reload

๐Ÿ“– Documentation

Core Documentation

DSPy Optimization

LLM Integration

Research & Future Work


๐Ÿงช Testing

# Run all tests
uv run pytest

# Run with coverage
uv run pytest --cov=src/agentcore --cov-report=html

# Run specific test categories
uv run pytest -m unit              # Unit tests only
uv run pytest -m integration       # Integration tests
uv run pytest -m performance       # Performance benchmarks
uv run pytest -m slow              # Long-running tests

# Run specific test file
uv run pytest tests/unit/test_llm_service.py

# Run with verbose output
uv run pytest -v

# Performance benchmarks
uv run pytest -m performance --durations=20

Test Coverage

Current test coverage: 94.2% (Target: >90%)

  • Unit Tests: 2,847 tests
  • Integration Tests: 1,312 tests
  • Performance Tests: 312 tests
  • E2E Tests: 127 tests

Total: 4,598 tests passing


๐Ÿ—๏ธ Architecture

Component Overview

agentcore/
โ”œโ”€โ”€ a2a_protocol/           # A2A protocol implementation
โ”‚   โ”œโ”€โ”€ models/             # Pydantic models (AgentCard, Task, Event, etc.)
โ”‚   โ”œโ”€โ”€ services/           # Business logic (AgentManager, TaskManager, etc.)
โ”‚   โ”œโ”€โ”€ routers/            # FastAPI endpoints
โ”‚   โ”œโ”€โ”€ database/           # PostgreSQL models and repositories
โ”‚   โ””โ”€โ”€ metrics/            # Prometheus metrics collection
โ”‚
โ”œโ”€โ”€ agent_runtime/          # Agent execution engine
โ”‚   โ”œโ”€โ”€ engines/            # CoT reasoning, planning
โ”‚   โ”œโ”€โ”€ services/           # Tool integration, memory management
โ”‚   โ””โ”€โ”€ config/             # Runtime configuration
โ”‚
โ”œโ”€โ”€ dspy_optimization/      # DSPy optimization framework
โ”‚   โ”œโ”€โ”€ algorithms/         # MIPROv2, GEPA, BootstrapFewShot
โ”‚   โ”œโ”€โ”€ analytics/          # Performance analytics, ROI tracking
โ”‚   โ”œโ”€โ”€ learning/           # Online learning, drift detection
โ”‚   โ”œโ”€โ”€ monitoring/         # Metrics collection, baselines
โ”‚   โ”œโ”€โ”€ plugins/            # Custom algorithm registry
โ”‚   โ”œโ”€โ”€ testing/            # A/B testing, experiments
โ”‚   โ””โ”€โ”€ tracking/           # MLflow integration
โ”‚
โ”œโ”€โ”€ llm_gateway/            # Multi-provider LLM integration
โ”‚   โ”œโ”€โ”€ providers/          # OpenAI, Anthropic, Gemini clients
โ”‚   โ”œโ”€โ”€ models.py           # Request/response models
โ”‚   โ”œโ”€โ”€ failover.py         # Automatic failover logic
โ”‚   โ”œโ”€โ”€ cost_tracker.py     # Cost monitoring
โ”‚   โ””โ”€โ”€ cache_service.py    # Response caching
โ”‚
โ”œโ”€โ”€ orchestration/          # Workflow orchestration
โ”‚   โ”œโ”€โ”€ engines/            # Graph planning, execution
โ”‚   โ”œโ”€โ”€ events/             # Event streaming
โ”‚   โ””โ”€โ”€ performance/        # Benchmarking, optimization
โ”‚
โ”œโ”€โ”€ gateway/                # API gateway services
โ”‚   โ”œโ”€โ”€ routing.py          # Request routing
โ”‚   โ”œโ”€โ”€ health_monitor.py   # Health checks
โ”‚   โ””โ”€โ”€ load_balancer.py    # Load distribution
โ”‚
โ””โ”€โ”€ integration/            # External service integrations
    โ”œโ”€โ”€ api/                # API connectors
    โ”œโ”€โ”€ storage/            # Blob storage (Azure, S3)
    โ””โ”€โ”€ security/           # Credential management

Technology Stack

Backend:

  • Python 3.12+ with asyncio
  • FastAPI for HTTP/WebSocket APIs
  • PostgreSQL 14+ (async via asyncpg)
  • Redis 7+ for caching and pub/sub

Optimization:

  • DSPy for prompt optimization
  • MLflow for experiment tracking
  • SciPy for statistical analysis
  • NetworkX for graph algorithms

Observability:

  • Prometheus for metrics
  • Grafana for dashboards
  • OpenTelemetry for distributed tracing
  • Structured logging with structlog

Deployment:

  • Kubernetes for orchestration
  • Docker for containerization
  • Alembic for database migrations
  • GitHub Actions for CI/CD

๐ŸŽ“ Example Usage

Registering an Agent

import httpx

# Agent registration
agent_card = {
    "agent_id": "my-agent-001",
    "name": "My Agent",
    "description": "A sample intelligent agent",
    "capabilities": ["text_generation", "data_analysis"],
    "version": "1.0.0",
    "owner": "team@example.com"
}

request = {
    "jsonrpc": "2.0",
    "method": "agent.register",
    "params": {"agent_card": agent_card},
    "id": "1"
}

async with httpx.AsyncClient() as client:
    response = await client.post(
        "http://localhost:8001/api/v1/jsonrpc",
        json=request
    )
    print(response.json())

Running DSPy Optimization

from agentcore.dspy_optimization.pipeline import DSPyOptimizationPipeline
from agentcore.dspy_optimization.models import OptimizationRequest

# Initialize pipeline
pipeline = DSPyOptimizationPipeline()

# Configure optimization
request = OptimizationRequest(
    target="prompt_template",
    objective="maximize_accuracy",
    algorithm="miprov2",
    evaluation_metric="f1_score",
    max_iterations=100
)

# Run optimization
result = await pipeline.optimize(request)
print(f"Optimized prompt: {result.optimized_prompt}")
print(f"Performance improvement: {result.improvement_percentage}%")

Creating and Executing Tasks

# Create task
task_definition = {
    "description": "Analyze customer feedback and extract insights",
    "requirements": ["text_analysis", "sentiment_detection"],
    "priority": "high",
    "timeout_seconds": 300
}

create_request = {
    "jsonrpc": "2.0",
    "method": "task.create",
    "params": {
        "task_definition": task_definition,
        "auto_assign": True
    },
    "id": "2"
}

response = await client.post(
    "http://localhost:8001/api/v1/jsonrpc",
    json=create_request
)
execution_id = response.json()["result"]["execution_id"]

# Monitor task progress via WebSocket
async with client.websocket_connect("ws://localhost:8001/ws") as ws:
    subscribe_msg = {
        "jsonrpc": "2.0",
        "method": "event.subscribe",
        "params": {
            "event_types": ["task.updated", "task.completed"],
            "filters": {"execution_id": execution_id}
        },
        "id": "3"
    }
    await ws.send_json(subscribe_msg)

    # Receive real-time updates
    async for message in ws:
        event = message.json()
        print(f"Task update: {event['event_type']}")
        if event["event_type"] == "task.completed":
            break

๐Ÿ”ฌ Performance Benchmarks

Optimization Performance

  • Graph Planning: <1s for 1000+ node workflows
  • Event Processing: 15,000+ events/second
  • DSPy Optimization: <5 minutes for typical prompts
  • LLM Latency: P95 <500ms (with caching)

Scalability

  • Concurrent Agents: 1000+ agents per instance
  • Task Throughput: 500+ tasks/second
  • WebSocket Connections: 10,000+ concurrent
  • Database: 100,000+ ops/second with PostgreSQL

Resource Usage

  • Memory: ~500MB baseline, scales with workload
  • CPU: 2-4 cores typical, scales with parallelism
  • GPU (optional): 1x GPU for DSPy acceleration

๐Ÿ› ๏ธ Development

Setting Up Development Environment

# Install development dependencies
uv sync --dev

# Run linting
uv run ruff check src/ tests/

# Auto-fix linting issues
uv run ruff check --fix src/ tests/

# Type checking
uv run mypy src/

# Run tests with coverage
uv run pytest --cov=src/agentcore --cov-report=html

Code Quality Standards

  • Test Coverage: Minimum 90% required
  • Type Safety: Mypy strict mode enabled
  • Linting: Ruff with project-specific rules
  • Formatting: Black-compatible (via Ruff)
  • Documentation: Docstrings for all public APIs

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes with tests
  4. Ensure all tests pass (uv run pytest)
  5. Commit your changes (git commit -m 'feat: add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

๐Ÿ“ฆ Deployment

Kubernetes Deployment

# Apply Kubernetes manifests
kubectl apply -f k8s/

# Verify deployment
kubectl get pods -n agentcore
kubectl get svc -n agentcore

# Check logs
kubectl logs -f deployment/agentcore-api -n agentcore

# Scale deployment
kubectl scale deployment/agentcore-api --replicas=3 -n agentcore

Environment Variables

# Database
DATABASE_URL=postgresql+asyncpg://user:pass@host:5432/agentcore
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=agentcore
POSTGRES_USER=agentcore
POSTGRES_PASSWORD=secure_password

# Redis
REDIS_URL=redis://localhost:6379/0
REDIS_PASSWORD=secure_password

# Security
JWT_SECRET_KEY=your-secret-key-here
JWT_ALGORITHM=HS256
JWT_EXPIRATION_HOURS=24

# LLM Providers
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=AI...

# MLflow (Optional)
MLFLOW_TRACKING_URI=http://mlflow:5000
MLFLOW_EXPERIMENT_NAME=agentcore-optimization

# Monitoring
ENABLE_METRICS=true
PROMETHEUS_PORT=9090
LOG_LEVEL=INFO

๐Ÿ“Š Monitoring & Observability

Prometheus Metrics

  • agentcore_agent_count: Number of registered agents
  • agentcore_task_count: Total tasks by status
  • agentcore_llm_requests_total: LLM API requests
  • agentcore_llm_latency_seconds: LLM response latency
  • agentcore_optimization_runs_total: DSPy optimization runs
  • agentcore_event_throughput: Event processing rate

Grafana Dashboards

  • Agent health and activity
  • Task execution metrics
  • LLM usage and costs
  • DSPy optimization performance
  • System resource utilization

Distributed Tracing

All requests include A2A context with:

  • trace_id: End-to-end request tracking
  • source_agent: Originating agent
  • target_agent: Destination agent
  • session_id: User session tracking
  • timestamp: Request timestamp

๐Ÿค Community & Support


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments

  • Google A2A Protocol - Standardized agent communication
  • DSPy Framework - Prompt optimization algorithms
  • Stanford NLP - Research and innovation
  • FastAPI - Modern Python web framework
  • Pydantic - Data validation and settings management

๐Ÿ—บ๏ธ Roadmap

Q4 2025

  • โœ… DSPy optimization framework integration
  • โœ… Multi-provider LLM gateway with cost tracking
  • โœ… Production-ready deployment configurations
  • ๐Ÿ”„ OpenEnv training environment integration (planned)

Q1 2026

  • ๐Ÿ”ฎ Parallax POC for self-hosted LLM inference
  • ๐Ÿ”ฎ Enhanced monitoring and alerting
  • ๐Ÿ”ฎ Advanced workflow orchestration patterns
  • ๐Ÿ”ฎ Plugin marketplace for custom algorithms

Q2-Q3 2026

  • ๐Ÿ”ฎ Multi-region deployment support
  • ๐Ÿ”ฎ Advanced security features (SAML, SSO)
  • ๐Ÿ”ฎ Graph-based memory and knowledge management
  • ๐Ÿ”ฎ Enterprise SLA guarantees

Built with โค๏ธ by the AgentCore team

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

agentcore_sdk-0.1.0.tar.gz (3.6 MB view details)

Uploaded Source

Built Distribution

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

agentcore_sdk-0.1.0-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file agentcore_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: agentcore_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for agentcore_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bb075ab6e5b7fa96405849b35a227881d28634cfc88d8a600158d1357e1c6091
MD5 e6bbf62456a7fce2b2b4ddd14b642c34
BLAKE2b-256 a26d43c0667e274c2a7bfa2f560ba07d7bb210d1e1537e9b1321b0fa5230cd77

See more details on using hashes here.

File details

Details for the file agentcore_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agentcore_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for agentcore_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08a3c3da09a7c357bba62c5384557c3570279e2e6d7a179d9224eca0171f367a
MD5 91c11ef5533654feea569077df428df9
BLAKE2b-256 043b2743f146090b34a9f5fe25c040f0d34dcfc2588617545c0f810270249275

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