skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
docs.aegra.dev243 installs

aegra

Use when building, deploying, and managing self-hosted LangGraph agents. Reach for this skill when setting up agent infrastructure, configuring authentication, managing threads and state, streaming responses, implementing human-in-the-loop workflows, scheduling cron jobs, or deploying to production.

How do I install this agent skill?

npx skills add https://docs.aegra.dev --skill aegra
view source ↗

Is this agent skill safe to install?

  • Socketpass

    No alerts

What does this agent skill do?

Aegra Skill

Product summary

Aegra is an open-source, self-hosted Agent Protocol server for running LangGraph agents on your own infrastructure. It's a drop-in replacement for LangSmith Deployments with the same SDK and APIs. Agents run on PostgreSQL with optional Redis for multi-instance scaling. Key files: aegra.json (configuration), pyproject.toml (dependencies), .env (secrets). Primary CLI commands: aegra init (create project), aegra dev (local development), aegra serve (production), aegra up (Docker Compose). Primary docs: https://docs.aegra.dev

When to use

Reach for this skill when:

  • Setting up a new agent project — Initialize with templates, configure graphs, set environment variables
  • Configuring authentication — Add JWT, OAuth, Firebase, or custom auth handlers
  • Managing agent execution — Create threads, run agents, stream responses, handle interrupts
  • Implementing approval workflows — Add human-in-the-loop gates before tool execution
  • Scheduling recurring tasks — Create cron jobs with timezone support and webhooks
  • Storing persistent data — Use key-value store or semantic search with vector embeddings
  • Deploying to production — Configure for Docker, PaaS (Railway, Render, Fly.io), or Kubernetes
  • Debugging and observability — Stream events, inspect thread state, trace to OTLP backends

Quick reference

CLI commands

CommandPurpose
aegra initCreate new project (prompts for template and location)
aegra devLocal dev server with hot reload and managed PostgreSQL
aegra serveProduction server (requires external PostgreSQL)
aegra upStart Docker Compose services (PostgreSQL + app)
aegra downStop Compose services
aegra versionShow version info

Configuration file (aegra.json)

SectionPurpose
graphsDefine LangGraph agents (path to compiled graph or factory function)
authAuthentication handler (JWT, OAuth, Firebase, or custom)
httpCustom FastAPI routes and CORS settings
storeSemantic search with vector embeddings (pgvector)
checkpointerThread TTL and checkpoint durability defaults
dependenciesShared module paths to add to sys.path

Environment variables (key ones)

VariablePurpose
OPENAI_API_KEYLLM API key (or your provider's key)
DATABASE_URLPostgreSQL connection (for aegra serve)
REDIS_BROKER_ENABLEDEnable Redis workers for multi-instance (default: false)
REDIS_URLRedis connection URL
AEGRA_CONFIGPath to config file (default: aegra.json)
AEGRA_THREAD_TTLThread expiry in minutes (overrides config)
AEGRA_CHECKPOINT_DURABILITYDefault checkpoint mode: sync, async, or exit

Core API patterns

Create and stream a run:

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

Create thread with metadata:

thread = await client.threads.create(
    metadata={"user_id": "alice", "session": "onboarding"}
)

Get thread state:

state = await client.threads.get_state(thread_id)
print(state["values"])  # Current state
print(state["interrupts"])  # Pending interrupts

Resume interrupted run:

async for chunk in client.runs.stream(
    thread_id=thread_id,
    assistant_id="agent",
    command={"resume": [{"type": "accept"}]},
):
    print(chunk)

Decision guidance

When to use each CLI command

ScenarioCommandWhy
Local developmentaegra devManages PostgreSQL, hot reload, simplest setup
Self-hosted Dockeraegra upCompose file handles both app and database
PaaS (Railway, Render, Fly.io)aegra serveNo Docker needed, uses managed database
Kubernetesaegra serveStateless, scales horizontally with Redis
Inside Docker containeraegra serveReplaces itself with uvicorn as PID 1

When to use each stream mode

ModeUse when
valuesYou need full state snapshots after each node
updatesYou only care about state deltas (smaller payloads)
messagesYou're streaming LLM tokens and tool calls
customYou emit custom data from graph nodes
eventsYou need fine-grained LangGraph event tracing
debugYou're debugging checkpoints and task results

When to use each checkpoint durability

ModeUse when
syncYou need to resume from the exact last step (slower)
async (default)You want background checkpointing with good recovery
exitYou have high-volume runs that never time-travel or mid-run recover

When to use factory graphs vs static graphs

ApproachUse when
Static graphGraph structure is fixed; no per-user customization needed
Factory functionYou need to customize tools, models, or topology per user/request
ServerRuntime[T] factoryYou manage resources (MCP, DB connections) or filter tools by permissions

Workflow

1. Initialize a new project

pip install aegra-cli
aegra init
# Choose: location, template (simple-chatbot or react-agent), name
cd <project>
cp .env.example .env
# Edit .env: add OPENAI_API_KEY
uv sync
uv run aegra dev

2. Define your agent graph

  • Edit the graph file (e.g., src/agent/graph.py)
  • Export a compiled graph or factory function
  • Register in aegra.json under graphs

3. Test locally

uv run aegra dev
# Visit http://localhost:2026/docs to test API
# Or use the LangGraph SDK to stream runs

4. Add authentication (if needed)

  • Create auth.py with @auth.authenticate handler
  • Reference in aegra.json under auth.path
  • Restart server

5. Add human-in-the-loop (if needed)

  • Call interrupt() in graph nodes at decision points
  • Client resumes with command={"resume": [...]}
  • Thread status becomes "interrupted" while paused

6. Configure for production

  • Set REDIS_BROKER_ENABLED=true for multi-instance
  • Add REDIS_URL and external DATABASE_URL
  • Configure auth, CORS, and webhooks in aegra.json
  • Use aegra serve or Docker

7. Deploy

  • Docker Compose: aegra up (local) or push Dockerfile to registry
  • PaaS: Set DATABASE_URL, REDIS_URL, run aegra serve
  • Kubernetes: Use aegra serve in pod spec, scale replicas with shared Redis/PostgreSQL

Common gotchas

  • Always install aegra-cli, not aegra — The aegra package is a meta-package without version pinning.
  • Thread IDs and assistant IDs must be 1–255 non-blank characters — Longer values are rejected with 422.
  • Graph IDs in aegra.json are used directly in API calls — Use simple, URL-safe names.
  • input and command are mutually exclusive — Don't send both when creating a run; use command only when resuming from an interrupt.
  • Checkpoint durability affects recovery behavior — exit mode means a crashed run restarts from the thread's last checkpoint, not the last step.
  • Redis is required for multi-instance deployments — Without it, runs execute as in-process asyncio tasks (single-instance only).
  • Webhooks must pass the URL policy — Loopback and private IPs are blocked by default; configure webhooks.url in aegra.json to allow them.
  • Stream mode debug and updates are sent only if explicitly requested — They're used internally but hidden from clients unless you ask for them.
  • Factory graphs are called per-request — Use runtime.execution_runtime to detect introspection vs. actual execution.
  • Metadata on threads is user-scoped — When auth is enabled, threads are automatically isolated per user.
  • Cron jobs fire immediately on creation — Pass enabled=false to suppress the first run.

Verification checklist

Before submitting work with Aegra:

  • Configuration is valid — Run aegra dev or aegra serve and check for startup errors
  • Graphs are registered — All graph IDs in aegra.json are correct and files exist
  • Environment variables are set — .env has all required keys (API keys, database URL, etc.)
  • Authentication is configured — If auth.path is set, the handler exists and is importable
  • Threads and runs work — Test creating a thread and streaming a run via SDK or API
  • State is persisted — Create a thread, run an agent, then fetch state and verify it matches
  • Interrupts work (if using HITL) — Verify thread status becomes "interrupted" and can be resumed
  • Streaming reconnects — Drop a connection mid-stream and reconnect with Last-Event-ID header
  • Crons fire on schedule — Create a cron and verify it runs at the expected time
  • Webhooks are called (if configured) — Check that run-completion webhooks reach your endpoint
  • Production settings are correct — If deploying, verify REDIS_BROKER_ENABLED, DATABASE_URL, and auth are set

Resources


For additional documentation and navigation, see: https://docs.aegra.dev/llms.txt

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/docs.aegra.dev/aegra">View aegra on skillZs</a>