Build with MuBit
Query patterns
Use routed retrieval, direct semantic search, and control filters for structured MuBit retrieval.
MuBit provides several retrieval patterns depending on your use case:
| Pattern | When to use |
|---|---|
control.query with mode: "agent_routed" | Default retrieval path — routes through the control plane for answer-oriented results |
control.query with entry_types, include_working_memory, agent_id, user_id | Scoped retrieval with fine-grained filters |
control.context | Model-ready context block with token budgeting before an LLM call |
client.core.search(...) | Direct semantic search when you need raw core hits (policy-gated) |
Routed retrieval example
answer = client.recall(
session_id="claim-123",
query="What changed in the claimant's story after the second interview?",
)Structured control query example
result = client.query(
run_id="claim-123",
query="Show failure lessons from prior fraud reviews",
entry_types=["lesson", "rule"],
include_working_memory=False,
mode="agent_routed",
)Direct semantic search example
results = client.core.search(
query_text="windshield replacement invoice",
k=5,
run_id="claim-123",
)Guidance
- Prefer
control.queryfor app and agent retrieval. - Prefer
control.contextbefore an LLM step. - Use direct semantic search only for advanced compatibility cases where you need raw core hits.
- Treat
user_idas a logical sub-scope tag only. It narrows retrieval inside the authenticated actor boundary and never expands access.