---
title: "Deploy Aegra"
description: "A self-hosted backend for building and running LangGraph AI agents."
category: "AI/ML"
url: https://railway.com/deploy/aegra
---

# Deploy Aegra

A self-hosted backend for building and running LangGraph AI agents.

**[Deploy Aegra on Railway](https://railway.com/template/aegra)**

- **Creator:** INF Labs
- **Category:** AI/ML

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### Aegra https://www.aegra.dev/logo.svg

- **Source:** codestorm-official/aegra-railway
- **Public domain:** Yes

## Documentation

# Deploy and Host Aegra on Railway

Aegra is an open-source backend for running LangGraph-compatible AI agents and Agent Protocol workloads. This template packages Aegra for Railway with PostgreSQL persistence and a minimal starter graph, providing a clean foundation for self-hosted agent applications.

## About Hosting Aegra

This Railway template deploys Aegra together with PostgreSQL as its persistent data layer.

Aegra runs as a stateless application service, while PostgreSQL stores persistent application state, metadata, and LangGraph checkpoints. The deployment is designed for developers who want to run LangGraph-compatible agents on their own infrastructure without manually assembling the runtime environment.

The Aegra service is built from the dedicated Railway wrapper repository:

`codestorm-official/aegra-railway`

The repository keeps the Railway deployment lightweight and avoids development-only dependencies and example configurations from the upstream monorepo.

## Common Use Cases

- Self-hosted LangGraph agent backends
- Agent Protocol-compatible applications
- Stateful AI assistants
- AI application APIs
- Custom LLM agents
- Tool-using agents
- Multi-step agent workflows
- Internal AI services
- Backend infrastructure for AI products
- Research and experimentation with agent systems

## Dependencies for Aegra Hosting

This template uses:

- **Aegra** for the agent runtime and API layer
- **LangGraph** for graph-based agent execution
- **PostgreSQL** for persistent state and checkpoints
- **Railway Private Networking** for secure internal database communication
- **Railway managed infrastructure** for application deployment and persistence

## Architecture

```text
        Users / Applications
                │
                ▼
              Aegra
                │
                ▼
           PostgreSQL
````

Aegra handles the agent runtime and application layer, while PostgreSQL provides persistent storage.

## Aegra Railway Repository

The deployment uses a small wrapper repository specifically designed for Railway.

Its purpose is to provide:

* A clean production container
* A minimal Aegra configuration
* A starter LangGraph graph
* PostgreSQL integration
* Reproducible dependency installation
* A Railway-friendly runtime
* No dependency on upstream development examples

This keeps the deployment easier to maintain and reduces unnecessary runtime complexity.

## Starter Graph

The template includes a minimal LangGraph smoke-test graph.

The starter graph:

* Requires no LLM API key
* Accepts a simple message
* Executes a basic LangGraph flow
* Returns the input message
* Can be replaced with a real agent implementation

Conceptually:

```text
START
  │
  ▼
 Echo
  │
  ▼
 END
```

This gives users a working baseline immediately after deployment while keeping the template provider-neutral.

## Persistent Architecture

Aegra itself remains stateless.

Persistent application data is stored in PostgreSQL, including runtime metadata and LangGraph checkpoints.

| Component  | Purpose                                      |
| ---------- | -------------------------------------------- |
| Aegra      | Agent runtime and application backend        |
| PostgreSQL | Persistent application state and checkpoints |

The Aegra service does not require its own persistent volume.

## LangGraph Compatibility

Aegra is designed to run LangGraph-compatible applications.

Developers can replace the included starter graph with their own graph implementation and use Aegra as the serving layer for:

* ReAct agents
* Stateful assistants
* Tool-calling agents
* Long-running workflows
* Multi-step reasoning systems
* Custom agent architectures

## LLM Provider Flexibility

The starter deployment does not require any specific model provider.

When replacing the starter graph with a real agent, developers can integrate providers supported by their LangChain or LangGraph application, including:

* OpenAI
* Anthropic
* OpenRouter
* Together AI
* Self-hosted model endpoints
* Other compatible providers

This keeps the Aegra runtime independent from a single LLM vendor.

## Scaling

The default deployment uses Aegra's local execution mode, which is suitable for a single application instance.

The architecture can later be extended for more advanced workloads, including:

* Dedicated background execution
* Redis-backed coordination
* Multiple application replicas
* Horizontal scaling
* More advanced agent workloads

For the base template, the simpler single-instance architecture keeps deployment predictable and lightweight.

## Aegra vs Managed Agent Platforms

| Feature                    | Aegra | Managed Agent Platform |
| -------------------------- | ----- | ---------------------- |
| Self-hosted                | ✅     | ❌ / Limited            |
| LangGraph compatibility    | ✅     | ✅                      |
| Agent Protocol support     | ✅     | Varies                 |
| Infrastructure control     | ✅     | ❌                      |
| PostgreSQL persistence     | ✅     | ✅                      |
| Custom agent code          | ✅     | Varies                 |
| Model provider flexibility | ✅     | Varies                 |
| Deployment portability     | ✅     | Limited                |
| Railway hosting            | ✅     | ❌                      |

## Why Self-Host Aegra?

Self-hosting Aegra gives developers greater control over their agent infrastructure.

This can be useful for:

* Private AI infrastructure
* Internal business applications
* Custom networking requirements
* Independent model selection
* Persistent agent state
* Integration with internal APIs and services
* Reducing dependency on managed agent deployment platforms

## Why Deploy Aegra on Railway?

Railway provides the infrastructure needed to run Aegra and PostgreSQL without manually managing servers.

Railway handles:

* Application deployment
* Private networking
* Persistent database storage
* Automatic HTTPS
* Environment management
* Container builds
* Service orchestration
* Infrastructure scaling

This allows developers to focus on building agents instead of maintaining the surrounding infrastructure.

## Who Is This Template For?

This template is suitable for:

* LangGraph developers
* AI application developers
* Backend engineers
* AI platform teams
* Researchers building agent systems
* Developers building self-hosted AI products
* Teams looking for greater control over agent deployment

## Aegra on Railway

Aegra and PostgreSQL together provide a compact foundation for self-hosted LangGraph-compatible applications.

The included starter graph makes the deployment immediately testable, while the dedicated Railway wrapper repository keeps the infrastructure clean and production-oriented.

From there, developers can replace the starter graph with their own agent logic and extend the runtime as their application grows.

## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/aegra
