Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content
Build with Mubit

Retrieve data

Use recall for answer-oriented retrieval and getContext for model-ready context assembly, with raw query only for explicit control.

Mubit exposes two default read patterns:

  • client.memory.recall() when you want Mubit to answer a question from memory
  • client.memory.context() (or run.context() inside a run) when you want a context block to send to your own model

Use raw control.query through client.raw.invoke when you need explicit control over low-level request fields or want to debug wire-level behavior.

Retrieval decision model

NeedRecommended method
Answer a question from stored memoryclient.memory.recall()
Build a prompt-ready context blockclient.memory.context() / run.context()
Inspect memory quality and gapsclient.memory.diagnose() and client.memory.health()
Explicit raw control over query payloadclient.raw.invoke("control.query", ...)
Compatibility-only direct lanesclient.raw.invoke("core.<op>", ...) routes when explicitly enabled

Helper-first retrieval examples

retrieve_helper.py
def retrieve_helper(client, run_id: str, question: str):
    answer = client.memory.recall(
        question,
        entry_types=["fact", "lesson", "rule"],
        run_id=run_id,
    )
    context = client.memory.context(
        question,
        lane="legacy",
        mode="summary",
        max_token_budget=400,
        run_id=run_id,
    )
    return answer, context

lane="legacy" selects the /v2/control/context assembler with its mode values (full, summary, sections). Without it, client.memory.context(task, budget=...) returns the run-scoped ContextBlock the wrappers inject; see SDK helpers.

What the helper path buys you

  • client.memory.recall() uses the current control-plane query contract without you assembling the raw payload manually.
  • client.memory.context() gives you sectioned, cache-friendly context assembly with optional budget control.
  • client.memory.diagnose() and client.memory.health() help you understand why retrieval is weak before you start changing prompts blindly.
ℹ️Note

The recall() / query response includes a citations array — 0-based indices into evidence marking which items grounded final_answer (empty when the answer abstains or cites no specific evidence). Use them to render source attributions or audit answer grounding.

Failure modes and troubleshooting

SymptomRoot causeFix
Answer ignores an important lessonEntry types or context budget too broadRestrict kinds and use client.memory.context() budgeting
Retrieval feels noisyYou are mixing compatibility-only direct lanes with routed pathsStandardize one default read path per workflow
You need wire-level parity checksHelper abstracts too muchDrop to client.raw.invoke("control.query", ...) for that case

Next steps