Skip to content

elias-leslie/agent-hub

Agent Hub

Self-hosted control plane for running, observing, and improving multi-provider AI agents.

Agent Hub — control plane for multi-provider AI agents

One gateway for every agent and model provider: the command-center dashboard, the agent catalog with model routing and fallbacks, live request/latency/cost monitoring, and a model catalog tracking readiness and price.

License Python Next.js

Why it exists

Most agent demos stop at chat. Agent Hub adds the operational layer needed to run agents as infrastructure: provider routing, persistent memory, sessions, access control, cost/latency visibility, and operator dashboards.

What you get

Provider routing

  • Unified completions and SSE streaming across many providers from one API: Gemini, OpenAI, OpenRouter, DeepSeek, Kimi/Moonshot, MiniMax, xAI, Zhipu (GLM), NVIDIA, Cloudflare Workers AI, OpenAI Codex, and any local OpenAI-compatible endpoint. (Anthropic/Claude is catalogued for reference but excluded from workload routing by design.)
  • Model-to-provider resolution from a catalog, per-agent routing with fallbacks, a provider circuit breaker, and runtime provider-health probing.
  • Image generation across Gemini, NVIDIA, MiniMax, and Cloudflare image adapters.

Memory, sessions, and agents

  • PostgreSQL + pgvector memory ("memory-first"): semantic search, episodes, learning extraction, tiering/promotion/retirement, and tiered context injection into completions, with citation tracking.
  • Stateful sessions with full history, branching, ingestion, LLM-generated summaries, and token accounting.
  • Named agents/personas with version history, per-agent model routing, a benchmark dashboard, and a self-improving persona ("Jenny") heartbeat.
  • A DB-backed prompts catalog with revisions/restore and per-agent assignments.

Orchestration and tools

  • Multi-agent orchestration: staged workflow (clarify → plan → execute → review → QA), maker-checker, chain, parallel fan-out, sub-agents, code-review, and a committee/roundtable.
  • Server-side tool execution with an agentic tool loop: shell, file read/write/edit, precision code search, and web search/research/fetch (backed by SearXNG and a CDP browser).

Operability and access control

  • Cost/latency telemetry, request logs, truncation events, analytics, and operator dashboards over a 6-axis model catalog (coding/reasoning/planning/ tool-use/instruction/design scores, plus per-token/image/second pricing).
  • Client registration and access control, per-project permissions, budgets and quotas, encrypted credential storage (Fernet at rest), and OAuth (Codex/PKCE).
  • Optional web research, browser, web push (VAPID), Telegram bot, and voice (faster-whisper STT → completion → edge-tts) integrations.
  • A Python SDK (agent-hub-client) with sync + async clients for completions, SSE streaming, stateful sessions, image generation, and memory operations.

Under the hood: ~36 API routers, multi-provider image/completion adapters, and 15 Hatchet background workflows (session summaries, memory governance, model catalog enrichment, persona heartbeat, retention, and more).

The target user is a developer or operator running their own agent infrastructure, not a hosted SaaS user.

How it compares

These capabilities aren't new on their own — observability platforms, gateways, and hosted routers each cover a slice. Agent Hub's bet is having them integrated and memory-first in one self-hosted control plane, rather than stitched together.

Agent Hub Langfuse LiteLLM OpenRouter
Primary role integrated control plane observability / tracing API gateway / proxy hosted routing API
Multi-provider routing with fallbacks
Persistent memory + context injection
Named agents/personas + session history
Cost / latency telemetry + operator dashboard partial
Self-hosted, no SaaS required

If you only need tracing, use Langfuse; only a gateway, use LiteLLM. Agent Hub is for running agents as infrastructure — routing, memory, sessions, and dashboards behind one self-hosted API.

⭐ If a self-hosted, memory-first agent control plane is useful to you, a star helps others find it.

Requirements

Native development:

  • Python 3.13+
  • Node.js 20+
  • pnpm 10+
  • PostgreSQL 15+ with pgvector support recommended
  • Redis
  • Hatchet, for workflow/worker execution

Container development:

  • Docker Engine with Docker Compose v2

Quickstart: bundled Docker stack

git clone https://github.com/elias-leslie/agent-hub.git
cd agent-hub
cp .env.example .env

Set the generated secrets in .env:

python - <<'PY'
from pathlib import Path
import base64
import os
import secrets
path = Path('.env')
values = {
    'POSTGRES_PASSWORD': secrets.token_urlsafe(24),
    'AGENT_HUB_ENCRYPTION_KEY': base64.urlsafe_b64encode(os.urandom(32)).decode(),
    'AGENT_HUB_SECRET_KEY': secrets.token_urlsafe(32),
    'INTERNAL_SERVICE_SECRET': secrets.token_urlsafe(32),
}
lines = path.read_text().splitlines()
seen = set()
next_lines = []
for line in lines:
    key = line.split('=', 1)[0] if '=' in line and not line.startswith('#') else None
    if key in values:
        next_lines.append(f'{key}={values[key]}')
        seen.add(key)
    else:
        next_lines.append(line)
for key, value in values.items():
    if key not in seen:
        next_lines.append(f'{key}={value}')
path.write_text('\n'.join(next_lines) + '\n')
PY

Generate the Hatchet client token and start the stack:

./scripts/generate-hatchet-dev-token.sh .env
docker compose --env-file .env up -d --build

Open:

For Docker, leave AGENT_HUB_DB_URL, AGENT_HUB_REDIS_URL, and TEST_AGENT_HUB_DB_URL blank. Compose injects container-internal service URLs.

Native development

cp .env.example .env.local
pnpm install

cd backend
uv sync --all-extras --dev
uv run alembic upgrade head
uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8003

Worker, in another shell:

cd backend
uv run python -m app.worker

Frontend, in another shell from the repo root:

pnpm --filter frontend dev -- --hostname 0.0.0.0 --port 3003

Configuration

Start from .env.example. Minimum native values:

AGENT_HUB_DB_URL=postgresql://agent_hub_app:PASSWORD@localhost:5432/agent_hub
AGENT_HUB_REDIS_URL=redis://localhost:6379/2
AGENT_HUB_ENCRYPTION_KEY=<44-character-fernet-key>
AGENT_HUB_SECRET_KEY=<random-secret>
HATCHET_CLIENT_TOKEN=<generated-token>
HATCHET_CLIENT_HOST_PORT=127.0.0.1:7070
HATCHET_CLIENT_TLS_STRATEGY=none

Provider API keys are optional. Configure only the providers you intend to use: ANTHROPIC_API_KEY, GEMINI_API_KEY, OPENAI_API_KEY, OPENROUTER_API_KEY, DEEPSEEK_API_KEY, KIMI_CODE_API_KEY, MOONSHOT_API_KEY, MINIMAX_API_KEY, XAI_API_KEY, ZHIPU_API_KEY, NVIDIA_API_KEY, and Cloudflare image keys.

If you expose Agent Hub beyond loopback, put it behind a reverse proxy or other network controls and set strong client/internal secrets. Empty provider keys are valid for local UI/API smoke tests, but provider-backed completions will be unavailable until configured.

Architecture

agent-hub/
├── backend/            FastAPI app, provider adapters, memory, workflows, tests
├── frontend/           Next.js dashboard and operator UI
├── packages/           Shared SDKs and UI packages
├── examples/           SDK usage examples
├── docker-compose.yml  Standalone local Docker stack
├── scripts/            Bootstrap and service helpers
└── docs/screenshots/   Public-safe UI screenshots

SDK

The Python SDK lives in packages/agent-hub-client and exposes the async client used for completions, SSE streaming, and stateful sessions.

pip install -e packages/agent-hub-client

Testing, linting, type checks, and build

Install dependencies first:

pnpm install --frozen-lockfile
cd backend && uv sync --all-extras --dev

Backend checks:

cd backend
uv run ruff check .
uv run ty check app
uv run pytest
uv build

Frontend checks:

pnpm --filter frontend lint
pnpm --filter frontend exec tsc --noEmit
pnpm --filter frontend exec vitest run
pnpm --filter frontend build

Smoke test a running app:

curl -fsS http://localhost:8003/health
curl -fsS http://localhost:3003/ >/dev/null

Screenshots

The checked-in screenshots use safe demo/empty data and were inspected before public release. To refresh them, start the local frontend and run:

cd frontend
AGENT_HUB_SCREENSHOT_BASE_URL=http://localhost:3003 pnpm screenshot:all

Inspect screenshots before committing them. Do not include provider tokens, private sessions, private infrastructure details, personal data, or customer content.

Optional and degraded behavior

Agent Hub can boot without provider keys. Dashboards, health checks, sessions, and configuration pages remain available. Provider completions, web research, push, Telegram, browser, and voice integrations require their corresponding configuration and should fail clearly when absent.

License

Apache License 2.0. See LICENSE and NOTICE. Security reporting is described in SECURITY.md.

About

Self-hosted control plane for multi-provider AI agents, sessions, credentials, prompts, and automation telemetry

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors