> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anonalabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# The three calls you actually need

> Record what happened, retrieve what matters, reason across it. Almost every integration is these three.

[← All use cases](/use-cases/overview)

<div className="uc-examples"><a href="https://github.com/anonalabs/Anona-Memory-SDK/blob/main/examples/memory_basics.py">memory\_basics.py</a></div>

## The scenario

You are adding memory to something and the API surface looks large. It is not.
Three calls carry almost every integration, and a fourth exists only to save you
writing a join.

## Step 1 — Record

```python theme={null}
client.record(space_id=space, content="Dana leads the mobile team and prefers RFC-style proposals.")
client.record(space_id=space, content="Dana rejected the last proposal for missing a rollback plan.")
```

You write sentences, not schemas. Extraction turns each one into facts as it
stores it, which is why you do not pre-chunk or pre-tag anything.

## Step 2 — Retrieve

Ranked rows, each with a score, when your code wants to do something with the
results.

```python theme={null}
for row in client.retrieve(space_id=space, query="How should I pitch a change to Dana?"):
    print(f"{row['relevance_score']:.2f}  {row['content']}")
```

## Step 3 — Reason

One synthesised answer across everything the space holds, rather than rows you
have to read yourself.

```python theme={null}
print(client.reason(space_id=space, query="What should I prepare before proposing a change?"))
```

`reason` runs a multi-step loop, so it costs more and answers vaguer questions.
Use `retrieve` when the caller can read rows; use `reason` when they need a
conclusion.

## Step 4 — `get_context`, when you build the prompt yourself

```python theme={null}
block = client.get_context(space_id=space, query="pitching a change to Dana", max_tokens=300)
```

The same search as `retrieve`, returned as one prompt-ready string with the
token budget enforced server-side. It saves a join and a truncation bug.

## Evals

1. Record three facts where the third only makes sense given the first two.
2. `retrieve` a question answerable from one of them. Check it ranks first.
3. `reason` a question that needs all three. Check the answer uses all three.
4. Ask something unrelated. Empty is the correct answer, and a system that
   invents one has its score floor set too low.

## Guardrails

* **Recording is asynchronous under the hood but `record` blocks** while
  extraction runs. In a request path, use
  [background writes](/use-cases/backfill-history) instead.
* **A space is created on first write.** A typo in `space_id` silently makes a
  new space rather than erroring — check `list_spaces` if memories go missing.
* **`relevance_score` can exceed 1.0.** It is a ranking signal, not a probability.

## The script

Complete and runnable:
[`memory_basics.py`](https://github.com/anonalabs/Anona-Memory-SDK/blob/main/examples/memory_basics.py).
