Brain Docs

Reference

RecipesSupport bot with memorySession summaryIdentity from a session JWTTune salience decayWalk the entity graphManual rate-limit backoff
Brain/Docs
✦ ASKBrain on GitHubDashboard
RecipesRecipes

Recipes

Copy-runnable Brain recipes — one concrete problem each, in TypeScript and Python, with the failure modes the happy path leaves out.

PURPOSE

Copy-runnable recipes for common Brain patterns. Each solves one concrete problem with the real SDK verbs, ships in TypeScript and Python where applicable, and spells out the failure mode the happy path hides — which is usually the part that costs you an afternoon.

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.

See also
BuildThe two calls, and where they go in an agent loop.GuidesLonger-form, teach-style integration walkthroughs.TypeScript SDK referenceEvery method, signature, and option.

Was this page helpful?

Pagination

Cursor-based enumeration on the HTTP tier, frame-based streaming on the wire, and the terminator each one uses.

Support bot with memory

A minimal chatbot loop that encodes the user turn, recalls prior context before responding, and encodes the assistant reply back.

On this page

Recipes
Suggest an editOpen in Playground