Introduction
CrewLayer is an open-source backend for AI agents. It provides persistent memory, shared context, a full action history, and multi-tenant isolation — all through a simple REST API and official SDKs.
The goal is that any developer can wire their agent into CrewLayer in minutes and never worry about state management, memory, or logs again. It works with any agent framework: LangChain, AutoGen, LlamaIndex, Vercel AI SDK, CrewAI, or plain Python.
CrewLayer is self-hosted, MIT-licensed, and ships as a single docker compose up -d command. No SaaS pricing. No data leaving your infrastructure. You own everything.
Architecture
CrewLayer is a FastAPI application backed by PostgreSQL (with pgvector) for long-term storage and Redis for short-term memory and pub/sub:
┌─────────────────────────────────────────────────────────────┐
│ Your Agent(s) │
│ (LangChain / AutoGen / SDK) │
└────────────────────────┬────────────────────────────────────┘
│ REST API / MCP tools
▼
┌─────────────────────────────────────────────────────────────┐
│ CrewLayer API (FastAPI) │
│ │
│ /v1/agents /v1/memory /v1/actions /v1/context │
│ /v1/sessions /v1/episodes /v1/evaluations /v1/webhooks │
└──────────┬──────────────────────────┬───────────────────────┘
│ │
┌──────▼──────┐ ┌───────▼───────┐
│ PostgreSQL │ │ Redis │
│ + pgvector │ │ │
│ │ │ Short-term │
│ Long-term │ │ memory │
│ memory │ │ Pub/sub │
│ Actions │ │ Status cache │
│ Agents │ └───────────────┘
│ Episodes │
└─────────────┘What it gives you
- Persistent Memory — Short-term messages in Redis per session, long-term facts in pgvector with semantic recall.
- Action Logger — Immutable append-only log of every tool call. Full input/output and timing.
- Shared Blackboard — Multi-agent coordination via a namespaced key-value store with Redis pub/sub and history.
- Sessions & Episodes — Group messages into sessions, sessions into episodes. Extract memories when sessions close.
- Evaluations & A/B Testing — LLM-as-a-judge scoring, anomaly detection, prompt versioning with rollback.
- Multi-tenant — Every resource is isolated per tenant. API keys with granular scopes.
- MCP Server — Use all features from Claude Desktop or Claude Code without writing HTTP.
- Web Dashboard — Built-in React dashboard at
/dashboard. Memory explorer, action timeline, A/B results, agent status. - Observability — Prometheus metrics at
/metricsand a prebuilt Grafana dashboard.
Tech stack
| Layer | Technology |
|---|---|
| API | FastAPI (Python 3.12+) |
| Primary DB | PostgreSQL 16 + pgvector |
| Cache / short-term memory | Redis 7 |
| Semantic embeddings | Anthropic API or local sentence-transformers |
| Memory extraction | claude-opus-4-8 |
| Auth | API Keys (bcrypt hash) + JWT for dashboard |
| Deploy | Docker Compose (one command) |
| Testing | pytest + httpx (441 tests) |
Next steps
Ready to get started? Head to Quick Start to have your first agent storing memories in under 5 minutes.
If you want to understand the data model first, read Core Concepts. For a full endpoint reference, see the API Reference.