Quick Start
This guide gets you from zero to a working CrewLayer backend with your first agent storing and recalling memories.
Prerequisites
- Docker + Docker Compose (Docker Desktop or standalone)
- Python 3.12+ (for the SDK and CLI; not needed if using the REST API directly)
- ANTHROPIC_API_KEY — used for memory extraction and embeddings
- 4 GB RAM minimum; 8 GB recommended
Step 1 — Clone the repo
1
Clone and enter the project
terminal
git clone https://github.com/GerardSole/CrewLayer
cd CrewLayer2
Configure environment
Copy the example environment file and fill in your values:
terminal
cp .env.example .envOpen .env and set at minimum:
.env
ANTHROPIC_API_KEY=sk-ant-...
SECRET_KEY=your-random-secret-key-here
DATABASE_URL=postgresql+asyncpg://crewlayer:crewlayer@postgres/crewlayer
REDIS_URL=redis://redis:6379
EMBEDDING_PROVIDER=anthropicFor SECRET_KEY, run python -c "import secrets; print(secrets.token_hex(32))" to generate a secure random value.
3
Start everything with Docker Compose
terminal
docker compose up -d
# Follow logs to confirm startup
docker compose logs api -fThis starts PostgreSQL, Redis, and the API. Once you see Application startup complete in the logs, CrewLayer is ready.
- API →
http://localhost:8000 - Dashboard →
http://localhost:8000/dashboard - API docs (Swagger) →
http://localhost:8000/docs
4
Create your first API key and agent
Use the wizard CLI, or do it manually with curl. CLI is faster:
terminal
# Install the CLI
pip install -e ".[cli]"
# Run the setup wizard (creates tenant + API key interactively)
crewlayer initOr manually with curl:
terminal
# Create a tenant (returns tenant_id)
curl -s -X POST http://localhost:8000/v1/tenants \
-H "Content-Type: application/json" \
-d '{"name": "my-org"}' | jq .
# Create an API key for that tenant
curl -s -X POST http://localhost:8000/v1/auth/keys \
-H "Content-Type: application/json" \
-d '{"name": "dev-key", "tenant_id": "TENANT_ID_HERE", "scopes": ["*"]}' | jq .
# Create your first agent
curl -s -X POST http://localhost:8000/v1/agents \
-H "X-API-Key: crwl_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"name": "my-agent"}' | jq .Save the agent_id from the response. You'll use it in every subsequent call.
5
Save and recall your first memory
Using the Python SDK:
first_memory.py
pip install -e "." # or: pip install crewlayer
from crewlayer import CrewLayerClient
client = CrewLayerClient(
base_url="http://localhost:8000",
api_key="crwl_YOUR_KEY_HERE",
)
AGENT_ID = "YOUR_AGENT_ID_HERE"
# Save a memory
client.memory.save(
agent_id=AGENT_ID,
content="The user's name is Alice and she prefers concise answers.",
importance=0.9,
)
print("Memory saved ✓")
# Recall it semantically
memories = client.memory.recall(
agent_id=AGENT_ID,
query="what do I know about the user?",
top_k=3,
)
for m in memories:
print(f" [{m['similarity']:.2f}] {m['content']}")Or with curl:
terminal
# Save a memory
curl -s -X POST http://localhost:8000/v1/agents/$AGENT_ID/memory \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "User prefers concise answers.", "importance": 0.9}' | jq .
# Recall semantically
curl -s -X POST http://localhost:8000/v1/agents/$AGENT_ID/memory/recall \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "user preferences", "limit": 5}' | jq .Verify everything works
terminal
# Health check
curl http://localhost:8000/health
# → {"status": "ok", "db": "ok", "redis": "ok"}
# Run the test suite
docker compose exec api pytest tests/ -v --tb=shortAll set! Open http://localhost:8000/dashboard to see your agent and its memories in the web dashboard.
What's next
- Core Concepts — understand agents, memory, sessions, and episodes
- Python SDK — full reference for every client method
- MCP Server — use CrewLayer from Claude Desktop or Claude Code
- Integrations — LangChain, AutoGen, LlamaIndex, Vercel AI