aegra

Open source alternative to LangGraph Platform (now LangSmith Deployments) - Self-hosted AI agent backend with FastAPI and PostgreSQL. Zero vendor lock-in, full control over your agent infrastructure.

Automatically checked · GitHub checked 2026-11-14

aegra

Overview

Aegra banner

Aegra

Self-hosted LangSmith Deployments alternative. Your infrastructure, your rules.

PyPI API PyPI CLI Downloads CI Codecov

GitHub stars License Discord Sponsor


Aegra is a drop-in replacement for LangSmith Deployments. Use the same LangGraph SDK, same APIs, but run it on your own infrastructure with PostgreSQL persistence.

Works with: Agent Chat UI | LangGraph Studio | AG-UI / CopilotKit

🆕 New: Agent Protocol v2 streaming. Thread-scoped SSE with content-block events, per-subgraph lifecycle, and native human-in-the-loop resume — the wire the latest LangGraph SDKs and useStream() target. Enabled by default. See the streaming guide.

🚀 Quick Start

Using the CLI (Recommended)

Prerequisites: Python 3.12+, Docker or Podman (for PostgreSQL; Docker is the default)

pip install aegra-cli

# Initialize a new project — prompts for location, template, and name
aegra init

# Follow the printed next steps:
cd <your-project>
cp .env.example .env     # Add your OPENAI_API_KEY to .env
uv sync                  # Install dependencies
uv run aegra dev         # Start PostgreSQL + dev server

Note: Always install aegra-cli directly — not the aegra meta-package. The aegra package on PyPI is a convenience wrapper that does not support version pinning.

From Source

git clone https://github.com/aegra/aegra.git
cd aegra
cp .env.example .env
# Add your OPENAI_API_KEY to .env

docker compose up

Open http://localhost:2026/docs to explore the API.

Your existing LangGraph code works without changes:

from langgraph_sdk import get_client

client = get_client(url="http://localhost:2026")

assistant = await client.assistants.create(graph_id="agent")
thread = await client.threads.create()

async for chunk in client.runs.stream(
    thread_id=thread["thread_id"],
    assistant_id=assistant["assistant_id"],
    input={"messages": [{"type": "human", "content": "Hello!"}]},
):
    print(chunk)

🔥 Why Aegra?

Based on LangChain pricing as of February 2026. An enterprise tier with self-hosting is also available at custom pricing.

LangSmith DeploymentsAegra
Deploy agentsLocal dev only (Free), paid cloud (Plus)Free, unlimited
Custom authNot available (Free), available (Plus)Python handlers (JWT/OAuth/Firebase)
Scheduled cron jobsNot available (Free), available (Plus)Built-in, free
Self-hostedEnterprise only (license key required)Always (Apache 2.0)
Own databaseManaged only (Free/Plus), bring your own (Enterprise)Bring your own Postgres
TracingLangSmith onlyAny OTLP backend (Langfuse, Phoenix, etc.)
Data residencyLangChain cloud (Free/Plus), your infrastructure (Enterprise)Your infrastructure
SDKLangGraph SDKSame LangGraph SDK

✨ Features

  • Agent Protocol compliant - Works with Agent Chat UI, LangGraph Studio, CopilotKit
  • Worker architecture - Redis job queue with 30 concurrent runs per instance, lease-based crash recovery, and horizontal scaling across multiple instances
  • Scheduled cron jobs - Trigger runs on a schedule with standard 5-field or seconds-level 6-field expressions, IANA timezone support, and multi-instance safe SKIP LOCKED claim
  • Webhooks - Get a POST with the result when a run or a cron-fired run finishes, with LangGraph-compatible payloads and an SSRF-safe URL policy
  • Human-in-the-loop - Approval gates and user intervention points
  • Streaming - Real-time SSE streaming with cross-instance pub/sub and automatic reconnection with event replay. Supports both the legacy run-scoped stream and Agent Protocol v2 thread-scoped streaming (content-block events, per-subgraph lifecycle, HITL resume) for the latest LangGraph SDKs and useStream()
  • Persistent state - PostgreSQL checkpoints via LangGraph
  • Configurable auth - JWT, OAuth, Firebase, or none
  • Unified Observability - Fan-out tracing support via OpenTelemetry
  • Semantic store - Vector embeddings with pgvector
  • Custom routes - Add your own FastAPI endpoints

🛠️ CLI Commands

aegra init              # Interactive — asks for location, template, and name
aegra init ./my-agent   # Create at path (still prompts for template)

aegra dev               # Start development server (hot reload + auto PostgreSQL)
aegra serve             # Start production server (no reload)
aegra up                # Build and start Compose services (Docker by default, or Podman)
aegra down              # Stop Compose services

aegra version           # Show version info

📚 Documentation

docs.aegra.dev — Full documentation with guides, API reference, and configuration.

TopicDescription
QuickstartGet a running server in under 5 minutes
Configurationaegra.json format and all options
AuthenticationJWT, OAuth, Firebase, or custom auth handlers
Worker ArchitectureRedis job queue, crash recovery, horizontal scaling
Scheduled cron jobsTrigger runs on a schedule with timezone support and multi-instance safe claim
WebhooksGet notified when runs and cron-fired runs finish
Streaming8 SSE stream modes with reconnection
StoreKey-value and semantic search storage
ObservabilityFan-out tracing to Langfuse, Phoenix, or any OTLP backend
DeploymentDocker, PaaS, and Kubernetes deployment
MigrationMigrate from LangSmith Deployments

💬 Community & Support

🏗️ Built With

🤝 Contributing

We welcome contributions! See Contributing guide and check out good first issues.

💖 Support the Project

The best contribution is code, PRs, and bug reports - that's what makes open source thrive.

For those who want to support Aegra financially, whether you're using it in production or just believe in what we're building, you can become a sponsor. Sponsorships help keep development active and the project healthy.

📄 License

Apache 2.0 - see LICENSE.


⭐ Star us if Aegra helps you escape vendor lock-in ⭐

Star History Chart