Brain Docs

Reference

TypeScript SDKInstallationHTTP clientWire client
planreasonmaterializeProceduralqueryExplainqueryTrace
ErrorsRetriesPagination
Brain/Docs
✦ ASKBrain on GitHubDashboard
TypeScript SDKReasoningqueryExplain

queryExplain

See the plan Brain would run for a query, and its estimated cost — without running it.

PURPOSE

The plan Brain would run for a query, and what it would cost. It does not run the query.

POST/v1/query/explainBearer API keystable
queryExplain(input: QueryInput): Promise<QueryExplainResult>
Handshake credentialstable
queryExplain(request: QueryExplainRequest): Promise<QueryExplainResponse>

Parameters

ParameterTypeRequired
textstringrequired

The query text.

entityAnchorstringoptional

Anchor the graph retriever on an entity.

kindsstring[]optional

Restrict to these memory kinds.

predicatesstring[]optional

Restrict to these predicates.

sessions64-bit integer[]optional

Restrict to these sessions.

timeRangeTimeRangeoptional

fromUnixMs and toUnixMs, both optional.

asOfRecordTimeUnixNanos64-bit integeroptional

Read the space as it stood at that record time.

confidenceMinfloatoptional

Confidence floor.

includeTombstonedbooleanoptional

Defaults to false.

includeSupersededbooleanoptional

Defaults to false.

limitintegeroptional

Result cap.

retrieversstring[]optional

Pin the lanes instead of letting the router choose.

fusionFusionConfigoptional

k, semanticWeight, lexicalWeight and graphWeight — override the reciprocal-rank fusion parameters.

Returns

FieldTypePresence
planTextstringalways

The plan, as text.

estimatedCostMsfloatalways

What the planner thinks it would cost.

Two different questions

Pin retrievers and call this to ask "what would this plan cost". Leave retrievers unset to ask "what would the router pick today". The second answer changes as the space grows; the first does not.

The wire request wraps a full QueryRequest under a query field.

See also
queryTracerecall

Was this page helpful?

materializeProcedural

Render remembered directives into a system-prompt block, with the ids that went into it.

queryTrace

Run a query and get back what actually happened, with the measured latency.

On this page

ParametersReturns
Suggest an editOpen in Playground