Recipes
Copy-runnable Brain recipes — one concrete problem each, in TypeScript and Python, with the failure modes the happy path leaves out.
Recipes are not tutorials. Tutorials live in Learn
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 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, space), and run each request under that scope with act_as.
Tune salience decay
Speed up the salience-decay worker, and the floor you need to set for it to change anything a caller sees.
Walk the entity graph
Encode a transcript, list the entities the pipeline extracted, and walk the relation graph with the typed-graph verbs.
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?