Recipes
Copy-runnable Brain recipes — under a screen of code each, problem-focused, using the real encode / recall / forget verbs.
Recipes are not tutorials. Tutorials live in Get Started
and Guides — they teach concepts and walk you through your first
build. Recipes assume you already have the SDK installed
(@brain-db/sdk /
brain-db-sdk) and a client constructed; they hand
you the smallest piece of working code that solves a specific problem.
Every recipe uses the three memory verbs — encode (write), recall (read),
forget (delete) — plus the typed-graph and admin surfaces where a recipe
needs them. For the full method reference see the API reference and the
per-language SDK sections.
If a pattern doesn't appear here, check Guides — anything longer than a screen lives there. If you have a recipe you'd like to see, open an issue at github.com/arc-labs-ai/brain-db.
Recipes
Support bot with memory
A chatbot loop that encodes the user turn, recalls prior context before answering, and encodes the assistant reply back.
Session summary
At the end of a session, recall the salient memories, summarize them with your LLM, and encode the summary back as one durable memory.
Identity from a session JWT
SSR pattern: verify your app's session JWT, derive the caller's
(namespace, agent), and run each request under that scope with act_as.
Tune confidence decay
Speed up the confidence-decay worker for a fast-moving deployment through
Brain's TOML config and BRAIN__WORKERS__* overrides.
Walk the entity graph
Encode a transcript, list the entities the pipeline extracted, and walk
the relation graph with /v1/entities and /v1/graph.
Manual rate-limit backoff
Catch a 429 / 503, honor Retry-After, and retry — taking over from
the SDK's built-in auto-retry when you need to.
Was this page helpful?