Metadata-Version: 2.4
Name: fastagentic
Version: 1.0.0
Summary: The deployment layer for agentic applications. Build agents with anything. Ship them with FastAgentic.
Project-URL: Homepage, https://github.com/fastagentic/fastagentic
Project-URL: Documentation, https://fastagentic.dev
Project-URL: Repository, https://github.com/fastagentic/fastagentic
Author: FastAgentic Team
License: MIT
Keywords: a2a,agents,ai,deployment,fastapi,llm,mcp
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: aiofiles<24.0.0,>=23.2.0
Requires-Dist: anyio<5.0.0,>=4.7.0
Requires-Dist: fastapi<2.0.0,>=0.115.0
Requires-Dist: httpx<1.0.0,>=0.28.0
Requires-Dist: pydantic-settings<3.0.0,>=2.6.0
Requires-Dist: pydantic<3.0.0,>=2.10.0
Requires-Dist: rich<14.0.0,>=13.9.0
Requires-Dist: sse-starlette<3.0.0,>=2.2.0
Requires-Dist: structlog<25.0.0,>=24.4.0
Requires-Dist: typer<1.0.0,>=0.15.0
Requires-Dist: uvicorn[standard]<1.0.0,>=0.32.0
Provides-Extra: adapters
Requires-Dist: crewai>=0.86.0; extra == 'adapters'
Requires-Dist: langchain-core>=0.3.0; extra == 'adapters'
Requires-Dist: langchain>=0.3.0; extra == 'adapters'
Requires-Dist: langgraph>=0.2.0; extra == 'adapters'
Requires-Dist: pydantic-ai>=0.0.30; extra == 'adapters'
Provides-Extra: all
Requires-Dist: crewai>=0.86.0; extra == 'all'
Requires-Dist: httpx>=0.28.0; extra == 'all'
Requires-Dist: langchain-core>=0.3.0; extra == 'all'
Requires-Dist: langchain>=0.3.0; extra == 'all'
Requires-Dist: langfuse>=2.57.0; extra == 'all'
Requires-Dist: langgraph>=0.2.0; extra == 'all'
Requires-Dist: mem0ai>=0.1.0; extra == 'all'
Requires-Dist: opentelemetry-api>=1.29.0; extra == 'all'
Requires-Dist: opentelemetry-exporter-otlp>=1.29.0; extra == 'all'
Requires-Dist: opentelemetry-instrumentation-fastapi>=0.50b0; extra == 'all'
Requires-Dist: opentelemetry-sdk>=1.29.0; extra == 'all'
Requires-Dist: portkey-ai>=1.9.0; extra == 'all'
Requires-Dist: pydantic-ai>=0.0.30; extra == 'all'
Requires-Dist: redis>=5.2.0; extra == 'all'
Provides-Extra: braintrust
Requires-Dist: braintrust>=0.0.170; extra == 'braintrust'
Provides-Extra: crewai
Requires-Dist: crewai>=0.86.0; extra == 'crewai'
Provides-Extra: dev
Requires-Dist: httpx>=0.28.0; extra == 'dev'
Requires-Dist: mypy>=1.13.0; extra == 'dev'
Requires-Dist: pre-commit>=4.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
Requires-Dist: pytest-cov>=6.0.0; extra == 'dev'
Requires-Dist: pytest>=8.3.0; extra == 'dev'
Requires-Dist: ruff>=0.8.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mike>=2.1.0; extra == 'docs'
Requires-Dist: mkdocs-material>=9.5.0; extra == 'docs'
Requires-Dist: mkdocs-minify-plugin>=0.8.0; extra == 'docs'
Requires-Dist: mkdocs>=1.6.0; extra == 'docs'
Provides-Extra: integrations
Requires-Dist: httpx>=0.28.0; extra == 'integrations'
Requires-Dist: langfuse>=2.57.0; extra == 'integrations'
Requires-Dist: mem0ai>=0.1.0; extra == 'integrations'
Requires-Dist: portkey-ai>=1.9.0; extra == 'integrations'
Provides-Extra: lakera
Requires-Dist: httpx>=0.28.0; extra == 'lakera'
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.3.0; extra == 'langchain'
Requires-Dist: langchain>=0.3.0; extra == 'langchain'
Provides-Extra: langfuse
Requires-Dist: langfuse>=2.57.0; extra == 'langfuse'
Provides-Extra: langgraph
Requires-Dist: langchain-core>=0.3.0; extra == 'langgraph'
Requires-Dist: langgraph>=0.2.0; extra == 'langgraph'
Provides-Extra: mem0
Requires-Dist: mem0ai>=0.1.0; extra == 'mem0'
Provides-Extra: otel
Requires-Dist: opentelemetry-api>=1.29.0; extra == 'otel'
Requires-Dist: opentelemetry-exporter-otlp>=1.29.0; extra == 'otel'
Requires-Dist: opentelemetry-instrumentation-fastapi>=0.50b0; extra == 'otel'
Requires-Dist: opentelemetry-sdk>=1.29.0; extra == 'otel'
Provides-Extra: portkey
Requires-Dist: portkey-ai>=1.9.0; extra == 'portkey'
Provides-Extra: postgres
Requires-Dist: asyncpg>=0.30.0; extra == 'postgres'
Requires-Dist: sqlalchemy>=2.0.0; extra == 'postgres'
Provides-Extra: pydanticai
Requires-Dist: pydantic-ai>=0.0.30; extra == 'pydanticai'
Provides-Extra: redis
Requires-Dist: redis>=5.2.0; extra == 'redis'
Provides-Extra: testing
Requires-Dist: faker>=24.0.0; extra == 'testing'
Requires-Dist: hypothesis-jsonschema>=0.23.0; extra == 'testing'
Requires-Dist: hypothesis>=6.100.0; extra == 'testing'
Requires-Dist: mutmut>=2.4.0; extra == 'testing'
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'testing'
Requires-Dist: pytest-benchmark>=4.0.0; extra == 'testing'
Requires-Dist: pytest-timeout>=2.3.0; extra == 'testing'
Description-Content-Type: text/markdown

# FastAgentic

> **Build agents with anything. Ship them with FastAgentic.**

[![Tests](https://img.shields.io/badge/tests-608%20passed-brightgreen)]()
[![Python](https://img.shields.io/badge/python-3.10%2B-blue)]()
[![License](https://img.shields.io/badge/license-MIT-green)]()

FastAgentic is the **deployment layer** for agentic applications. It transforms agents built with PydanticAI, LangChain, LangGraph, or CrewAI into production-ready services with REST, MCP, and streaming interfaces—plus authentication, policy, observability, and durability baked in.

**FastAgentic is not an agent framework. It deploys them.**

```
┌─────────────────────────┐     ┌─────────────────────────┐
│   Your Agent Logic      │     │      FastAgentic        │     REST, MCP, SSE, WebSocket
│   ─────────────────     │ ──► │   (Deployment Layer)    │ ──► Auth, Policy, Telemetry
│   PydanticAI            │     │                         │     Durability, Cost Control
│   LangGraph             │     │   One decorator =       │
│   CrewAI                │     │   Production service    │
│   LangChain             │     │                         │
└─────────────────────────┘     └─────────────────────────┘
```

## Supported Adapters

| Framework | Adapter | Best For |
|-----------|---------|----------|
| **PydanticAI** | `PydanticAIAdapter` | Type-safe agents, structured outputs |
| **LangGraph** | `LangGraphAdapter` | Stateful graph workflows, cycles |
| **CrewAI** | `CrewAIAdapter` | Multi-agent collaboration |
| **LangChain** | `LangChainAdapter` | Chains, LCEL runnables |
| **Custom** | `BaseAdapter` | Your own framework |

## What You Get

| Without FastAgentic | With FastAgentic |
|---------------------|------------------|
| Write REST endpoints manually | `@tool`, `@agent_endpoint` decorators |
| Build MCP server from scratch | Automatic MCP schema fusion |
| Implement auth middleware | OAuth2/OIDC built-in |
| Add streaming yourself | SSE/WebSocket/MCP streaming |
| Build checkpoint system | Redis/Postgres/S3 durability |
| Instrument observability | OTEL traces and metrics |
| Track costs manually | Automatic cost logging |
| Write deployment scripts | `fastagentic run` |

## Should You Use FastAgentic?

**Yes, if you:**
- Need to expose agents via REST and/or MCP protocols
- Require production governance (auth, policy, cost control, audit)
- Want to use multiple agent frameworks behind a unified interface
- Care about durability, streaming, and observability

**Not yet, if you:**
- Are experimenting with agent logic locally
- Have a single internal consumer with no governance needs
- Need an agent framework first (use PydanticAI, LangChain, etc.)

## Installation

```bash
# Core installation
pip install fastagentic

# Or with uv (recommended)
uv add fastagentic

# With specific adapter support
uv add "fastagentic[pydanticai]"
uv add "fastagentic[langgraph]"
uv add "fastagentic[crewai]"

# With integrations
uv add "fastagentic[langfuse]"    # Observability
uv add "fastagentic[portkey]"    # AI Gateway
uv add "fastagentic[lakera]"     # Security guardrails

# Everything
uv add "fastagentic[all]"
```

## Quick Start

```python
from fastagentic import App, agent_endpoint, prompt, resource, tool
from fastagentic.adapters.langgraph import LangGraphAdapter
from models import TicketIn, TicketOut, triage_graph

app = App(
    title="Support Triage",
    version="1.0.0",
    oidc_issuer="https://auth.mycompany.com",
    telemetry=True,
    durable_store="redis://localhost:6379",
)


@tool(
    name="summarize_text",
    description="Summarize ticket text into key points",
    scopes=["summaries:run"],
)
async def summarize(text: str) -> str:
    ...


@resource(name="run-status", uri="/runs/{run_id}", cache_ttl=60)
async def fetch_run(run_id: str) -> dict:
    ...


@prompt(name="triage_prompt", description="System prompt for support ticket triage")
def triage_prompt() -> str:
    return """
    You are a support triage assistant.
    Ask clarifying questions when urgency or impact is ambiguous.
    """


@agent_endpoint(
    path="/triage",
    runnable=LangGraphAdapter(triage_graph),
    input_model=TicketIn,
    output_model=TicketOut,
    stream=True,
    durable=True,
    mcp_tool="triage_ticket",      # Expose as MCP tool
    a2a_skill="support-triage",    # Expose as A2A skill
)
async def triage(ticket: TicketIn) -> TicketOut:
    ...
```

Run the framework with both ASGI and MCP entry points:

```bash
# Start the HTTP server
fastagentic run

# Or run as MCP server (for Claude Desktop, etc.)
fastagentic mcp serve app:app
```

The command boots the FastAPI application, registers MCP discovery metadata, and exposes streaming endpoints for agent workflows.

## First-Class Integrations

FastAgentic integrates with best-of-breed tools for specialized concerns:

```python
from fastagentic import App
from fastagentic.integrations import (
    LangfuseIntegration,    # Observability & tracing
    PortkeyIntegration,     # AI Gateway (200+ LLMs)
    LakeraIntegration,      # Security guardrails
    Mem0Integration,        # Intelligent memory
)

app = App(
    title="My Agent",
    integrations=[
        LangfuseIntegration(
            public_key="pk-...",
            secret_key="sk-...",
        ),
        LakeraIntegration(
            api_key="lak-...",
            block_on_detect=True,  # Block prompt injection
        ),
        Mem0Integration(
            api_key="m0-...",
            auto_search=True,      # Auto-inject relevant memories
        ),
    ]
)
```

| Integration | Purpose | Features |
|-------------|---------|----------|
| **Langfuse** | Observability | Tracing, analytics, prompt management |
| **Portkey** | AI Gateway | 200+ LLMs, fallbacks, caching |
| **Lakera** | Security | Prompt injection, PII detection |
| **Mem0** | Memory | Semantic memory, auto-extraction |

## Reliability Patterns

Built-in patterns for production resilience:

```python
from fastagentic import App, RetryPolicy, CircuitBreaker, RateLimit

app = App(
    title="Resilient Agent",
    retry_policy=RetryPolicy(
        max_attempts=3,
        backoff="exponential",
        retry_on=["rate_limit", "timeout"],
    ),
    rate_limit=RateLimit(
        rpm=60,
        tpm=100000,
        by="user",
    ),
)
```

## How It Fits Together

```
+-----------------------------------------------------------+
|                       FastAgentic                         |
|-----------------------------------------------------------|
|  @tool, @agent_endpoint, @resource, @prompt decorators     |
|  Schema fusion (Pydantic -> OpenAPI + MCP + A2A)          |
|  Unified Auth (OIDC/JWT -> MCP + A2A Auth Bridge)         |
|  Observability (OTEL traces, metrics, cost logs)          |
|  Policy (rate limits, quotas, roles, tenancy)             |
|  Streaming (SSE, WebSocket, MCP, gRPC)                    |
|  Durable jobs (Redis/Postgres checkpoints)                |
|  Agent Registry (internal + external A2A agents)          |
+-----------------------------------------------------------+
|    Adapter Layer (PydanticAI, LangGraph, CrewAI, etc.)    |
+-----------------------------------------------------------+
|          Core Stack (FastAPI, AsyncSQLAlchemy, OTEL SDK)  |
+-----------------------------------------------------------+
```

## Protocol Alignment

- MCP specification (2025-11-25) with Tasks, Extensions, and OAuth support
- A2A protocol (v0.3) for agent-to-agent collaboration and discovery
- OpenAPI 3.1 JSON schemas derived from Pydantic models
- OAuth2/OIDC bearer authentication with scoped policies
- Streaming surfaces: Server-Sent Events, WebSocket, and MCP event streaming

## Developer Tooling

| Command                     | Description                                     |
| --------------------------- | ----------------------------------------------- |
| `fastagentic run`           | Start the ASGI server                          |
| `fastagentic new`           | Scaffold a new application with sample modules  |
| `fastagentic info`          | Show information about the current app          |
| `fastagentic agent chat`    | Interactive CLI for agent testing               |
| `fastagentic agent query`   | Send single queries (scriptable)                |
| `fastagentic mcp serve`     | Run as MCP stdio server (for Claude Desktop)    |
| `fastagentic mcp schema`    | Print MCP schema (tools, resources, prompts)    |
| `fastagentic a2a card`      | Print A2A Agent Card                           |
| `fastagentic test contract` | Verify OpenAPI and MCP schema parity            |

## Roadmap Highlights

- **v0.1:** Core decorators, MCP schema fusion, adapters, SSE streaming
- **v0.2:** Reliability patterns, MCP stdio, first-class integrations (Langfuse, Portkey, Lakera, Mem0)
- **v0.3:** Policy engine, cost tracking, audit logging
- **v0.4:** Advanced prompt management, human-in-the-loop actions
- **v0.5:** Cluster orchestration, distributed checkpointing
- **v1.0:** Python SDK, PII detection, dashboard & metrics, production readiness checker
- **v1.1:** New adapters (Semantic Kernel, AutoGen, LlamaIndex, DSPy), template ecosystem
- **v1.2:** Interactive Agent CLI for testing and development

## Contributing

```bash
# Clone the repository
git clone https://github.com/fastagentic/fastagentic.git
cd fastagentic

# Install dependencies with uv
uv sync --extra dev

# Run tests
uv run pytest tests/ -v

# Run linting
uv run ruff check src/
```

## Learn More

**Getting Started**
- [Getting Started Guide](docs/getting-started.md)
- [Why FastAgentic?](docs/why-fastagentic.md)
- [Comparison with Alternatives](docs/comparison.md)

**Templates**
- [Templates Overview](docs/templates/index.md)
- [PydanticAI Template](docs/templates/pydanticai.md)
- [LangGraph Template](docs/templates/langgraph.md)
- [CrewAI Template](docs/templates/crewai.md)
- [Contributing Templates](docs/templates/contributing.md)

**Adapters**
- [Adapters Overview](docs/adapters/index.md)
- [PydanticAI Adapter](docs/adapters/pydanticai.md)
- [LangGraph Adapter](docs/adapters/langgraph.md)
- [CrewAI Adapter](docs/adapters/crewai.md)
- [LangChain Adapter](docs/adapters/langchain.md)
- [Custom Adapters](docs/adapters/custom.md)

**Protocols**
- [Protocol Overview](docs/protocols/index.md)
- [MCP Implementation](docs/protocols/mcp.md)
- [A2A Integration](docs/protocols/a2a.md)

**Operations**
- [Operations Guide](docs/operations/index.md)
- [Deployment (Docker, K8s, Serverless)](docs/operations/deployment/)
- [Configuration Reference](docs/operations/configuration/)
- [Observability](docs/operations/observability/)
- [Security & Compliance](docs/operations/security/)

**Developer Tools**
- [Agent CLI](docs/cli-agent.md) - Interactive testing and development

**Reference**
- [Runtime Architecture](docs/architecture.md)
- [Platform Services](docs/platform-services.md)
- [Roadmap](docs/roadmap.md)
