Brain Docs

Reference

Rust SDKInstallationHTTP clientWire client
planreasonmaterialize_proceduralquery_explainquery_trace
ErrorsRetriesPagination
Brain/Docs
✦ ASKBrain on GitHubDashboard
Rust SDKReasoningquery_explain

query_explain

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
async fn query_explain(&self, input: &QueryInput) -> Result<QueryExplainResult, BrainHttpError>
Handshake credentialstable
async fn query_explain(&self, request: &QueryExplainRequest) -> Result<QueryExplainResponse>

Parameters

ParameterTypeRequired
textstringrequired

The query text.

entity_anchorstringoptional

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.

time_rangeTimeRangeoptional

fromUnixMs and toUnixMs, both optional.

as_of_record_time_unix_nanos64-bit integeroptional

Read the space as it stood at that record time.

confidence_minfloatoptional

Confidence floor.

include_tombstonedbooleanoptional

Defaults to false.

include_supersededbooleanoptional

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
plan_textstringalways

The plan, as text.

estimated_cost_msfloatalways

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
query_tracerecall

Was this page helpful?

materialize_procedural

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

query_trace

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

On this page

ParametersReturns
Suggest an editOpen in Playground