Get Started with AgentBay
Persistent memory for AI agents. Start locally in 30 seconds, upgrade to cloud when ready.
Python
pip install agentbay
TypeScript
npm install agentbay
Python
from agentbay import AgentBay
ab = AgentBay() # local mode, no signup
# Store a memory
ab.memory.store(
title="Auth uses JWT",
content="We use JWT with 24h expiry and refresh tokens. Middleware validates on every request.",
type="PATTERN",
tags=["auth", "jwt", "security"]
)
# Recall relevant memories
result = ab.memory.recall("authentication")
for entry in result.entries:
print(f"{entry.title} ({entry.confidence:.0%})")
print(f" {entry.content[:100]}...")TypeScript
import { AgentBay } from 'agentbay';
const ab = new AgentBay(); // local mode
await ab.memory.store({
title: "Auth uses JWT",
content: "We use JWT with 24h expiry...",
type: "PATTERN",
tags: ["auth", "jwt", "security"],
});
const result = await ab.memory.recall("auth");
for (const entry of result.entries) {
console.log(entry.title, entry.confidence);
}Local mode uses SQLite + FTS5. No API key, no cloud, works fully offline.
brain.chat() automatically recalls relevant memories before your LLM call and stores the exchange afterward.
Python
reply = ab.brain.chat(
"How does our auth work?",
provider="openai",
model="gpt-4o",
provider_api_key="sk-..."
)
print(reply.message)
print(f"Used {len(reply.memories_used)} memories")TypeScript
const brain = ab.brain();
const reply = await brain.chat(
"How does our auth work?",
{
provider: "openai",
model: "gpt-4o",
providerApiKey: "sk-...",
}
);
console.log(reply.message);
console.log(`Used ${reply.memoriesUsed.length} memories`);Supports OpenAI, Anthropic, and custom providers. Add your own with register_provider().
When you need cloud sync, teams, or dreaming — create an account and add your API key.
# Sign up at https://www.aiagentsbay.com/register
# Then:
ab = AgentBay(
api_key="ab_live_...",
project_id="your-project-id"
)
# All your local memories sync to cloud automatically
# Now you get: dreaming, teams, 117 MCP tools, brain time machineFree tier: 1,000 memories, 5,000 API calls/month, 3 projects.
Set up AgentBay as the default memory for every Claude Code session — not just one project. Three steps, works across all directories.
Step A: Get your API key
# Go to https://www.aiagentsbay.com/dashboard/api-keys
# Click "Quick Agent Setup" to get a setup token
# Then exchange it:
curl -X POST https://www.aiagentsbay.com/api/v1/auth/setup \
-H "Content-Type: application/json" \
-d '{"token":"ab_setup_YOUR_TOKEN"}'
# → Returns your permanent ab_live_... keyStep B: Add to your shell
echo 'export AGENTBAY_API_KEY="ab_live_YOUR_KEY"' >> ~/.zshrc source ~/.zshrc
Step C: Add to global Claude Code settings
// Edit ~/.claude/settings.json — add mcpServers and env:
{
"mcpServers": {
"agentbay": {
"type": "http",
"url": "https://www.aiagentsbay.com/api/mcp",
"headers": {
"Authorization": "Bearer ${AGENTBAY_API_KEY}"
}
}
},
"env": {
"AGENTBAY_API_KEY": "ab_live_YOUR_KEY"
}
}Step D: Add global instructions (optional)
// Create ~/.claude/CLAUDE.md with: # Default Memory System You have AgentBay MCP connected globally. Use agentbay_memory_store for cross-project knowledge. Use agentbay_memory_recall to check for existing context.
After this, every new Claude Code session — in any directory — has AgentBay memory available. 117 MCP tools for memory, projects, teams, and agent collaboration.
Add AgentBay to any MCP-compatible tool:
// NPX (local proxy):
{
"mcpServers": {
"agentbay": {
"command": "npx",
"args": ["aiagentsbay-mcp", "--api-key", "ab_live_YOUR_KEY"]
}
}
}
// HTTP (direct, no npm needed):
{
"mcpServers": {
"agentbay": {
"url": "https://www.aiagentsbay.com/api/mcp",
"headers": { "Authorization": "Bearer ab_live_YOUR_KEY" }
}
}
}