// remember everything. learn from every run.
A three-layer memory system built for AI agents. Working memory for live sessions, episodic storage for long-term history, and a lesson graduation engine that makes your agents genuinely smarter over time.
Short-lived entries for the current session — active task state, in-progress results, temporary notes. Automatically expires so your agent never acts on stale data.
24h TTL · auto-expireTimestamped events from every run — what happened, what changed, what the outcome was. Searchable across all sessions by semantic meaning or keyword.
permanent · searchableStaged lessons reviewed and graduated to permanent rules. Your agents accumulate domain knowledge that automatically shapes future behavior — no manual retraining.
staged → accepted · permanent/context at the start of any agent run to load all relevant episodes and accepted lessons in a single request.| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /api/v1/memory/context | Bearer | Load session context — returns relevant episodes + accepted lessons |
| POST | /api/v1/memory/working | Bearer | Save a working memory entry with 24h TTL |
| POST | /api/v1/memory/episodes | Bearer | Record an episodic event (session event, finding, observation) |
| GET | /api/v1/memory/search | Bearer | Semantic search across all memory layers (?q=...&limit=10) |
| GET | /api/v1/memory/lessons | Bearer | List all lessons — staged and accepted |
| POST | /api/v1/memory/lessons | Bearer | Create a new staged lesson for review |
| POST | /api/v1/memory/lessons/{id}/graduate | Bearer | Promote a staged lesson to accepted (permanent) |
import httpx class AgentBrainClient: def __init__(self, base_url: str, token: str): self.base = base_url self.headers = {"Authorization": f"Bearer {token}"} def start_session(self, keywords: str): # Load relevant context for the current task return httpx.get( f"{self.base}/api/v1/memory/context", headers=self.headers, params={"q": keywords} ).json() def remember(self, content: str, tags=None): # Save an episode from the current session return httpx.post( f"{self.base}/api/v1/memory/episodes", headers=self.headers, json={"content": content, "tags": tags or []} ).json() def search(self, query: str, limit: int = 10): # Search across all memory layers return httpx.get( f"{self.base}/api/v1/memory/search", headers=self.headers, params={"q": query, "limit": limit} ).json() # ── Session lifecycle ────────────────────────────── brain = AgentBrainClient("https://api.agentbrain.nexuslayer.eu", token) ctx = brain.start_session("payment processing billing") # ctx["episodes"] — relevant history # ctx["lessons"] — accepted rules to apply brain.remember("Stripe webhook requires idempotency key", ["billing", "stripe"])
# Install the brain CLI (ships with AgentBrain) # ~/.local/bin/brain # Load context at session start brain context "payment processing billing" # Push an episode during the session brain push "Stripe webhook needs idempotency key — causes duplicate charges without it" "billing,stripe" # Search all memory layers brain search "billing webhook" # List all accepted lessons brain lessons # End-of-session summary brain summary "SESSION: Fixed Stripe webhook handler. Added idempotency key. Next: test with live events." "billing,session"