recall
Retrieve an answer for a cue with recall — the Single / Many / None membership shape, request fields, and response for both clients.
Signature
// HTTP client
brain.recall(input: http.RecallInput): Promise<http.RecallResult>
// wire client
client.recall(request: RecallRequest): Promise<RecallAnswer>The membership shape
recall resolves how many memories answer the cue, not a page of ranked hits:
answerKind | Meaning | memories |
|---|---|---|
None | Brain has nothing to say — a "don't know". | empty |
Single | Exactly one memory answers. | one entry |
Many | Several memories answer. | several entries |
The casing differs by transport: the HTTP client returns lowercase
("single" / "many" / "none"), the wire client returns capitalized
("Single" / "Many" / "None"). Match the transport you are using.
Request fields
querystringrequiredThe cue to recall against.
max_resultsnumberoptionalCap on returned memories.
subjectstringoptionalName of the subject to resolve facts about.
Build with RecallBuilder(cueText), which defaults to 10 results and mints the
requestId. Key fields:
cueTextstringrequiredThe cue to recall against.
subjectNamestringoptionalSubject to resolve facts about (.subject(name)). Empty for none.
maxResultsnumberoptionalCap on returned memories (.maxResults(n), default 10).
kindFilterMemoryKindWire[] | nulloptionalRestrict to certain memory kinds (.kinds([...])).
asOfRecordTimeUnixNanosbigint | nulloptionalResolve against record-time state as of an instant (.asOf(nanos),
bi-temporal).
confidenceThresholdnumberoptionalMinimum confidence (.confidence(t)).
salienceFloornumberoptionalMinimum salience (.salience(f)).
includeEdges / includeGraph / includeTextbooleanoptionalToggle edge, graph-enrichment, and text payloads (.edges(), .graph(),
.text()).
tracebooleanoptionalOpt into the per-stage read-pipeline trace on the final frame (.trace()).
This is the read-side knob.
actAsActAs | nulloptionalRun as an effective identity (.actAs(namespace, agentId)); requires the
canActAs grant.
Response
RecallResult:
answer_kind"single" | "many" | "none"alwaysThe membership verdict.
memories[]MemoryHit[]alwaysThe supporting memories. Empty when answer_kind is "none".
Each MemoryHit carries memory_id, text, similarity_score, confidence,
salience, kind, and created_at_unix_nanos.
RecallAnswer:
answerKind"Single" | "Many" | "None"alwaysThe membership verdict, taken from the final streamed frame.
memories[]MemoryResult[]alwaysEvery streamed frame's memories concatenated.
MemoryResult carries memoryId, text, similarityScore, confidence,
salience, kind, fusedScore, rerankScore, contributingRetrievers,
timestamps, and (when requested) edges and graph.
Examples
const answer = await brain.recall({ query: "where does the user live?" });
if (answer.answer_kind === "none") {
console.log("don't know");
} else {
console.log(answer.memories[0].text);
}import { RecallBuilder } from "@brain-db/sdk";
const answer = await client.recall(
new RecallBuilder("where does the user live?").maxResults(5).build(),
);
if (answer.answerKind === "None") {
console.log("don't know");
} else {
console.log(answer.memories[0].text);
}Streamed frames (wire only)
recall drains the streamed RECALL_RESP frames for you. For the raw frames —
cumulative counts, estimatedRemaining, per-frame isFinal — use
recallFrames, which returns RecallResponseFrame[]:
const frames = await client.recallFrames(
new RecallBuilder("recent decisions").build(),
);
for (const f of frames) console.log(f.cumulativeCount, f.isFinal);Was this page helpful?