> ## 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.

# Reason

> Synthesize a single answer across everything a space has accumulated, instead of a ranked list.

Most memory APIs stop at retrieval: they hand back a ranked list and leave the reasoning
to you. Reason goes a step further. It runs an agentic pass across the memories in a
space, connecting related facts, weighing recency, and resolving what matters, then
returns one synthesized answer.

|              | [Retrieve](/api-reference/retrieve)      | Reason                                  |
| ------------ | ---------------------------------------- | --------------------------------------- |
| **Returns**  | A ranked list of memories                | A single synthesized answer             |
| **Latency**  | Low                                      | Higher, it reasons across the space     |
| **Cost**     | Lower                                    | Higher                                  |
| **Use when** | You want context to inject into a prompt | You want a conclusion, not the evidence |

## Reason over a space

```http theme={null}
POST /v1/reason
Authorization: Bearer anona_live_YOUR_KEY
Content-Type: application/json
```

```json theme={null}
{
  "space_id": "customer-support-bot",
  "query": "What have we learned about Alice's career?"
}
```

| Parameter  | Type   | Required | Description                     |
| ---------- | ------ | -------- | ------------------------------- |
| `space_id` | string | Yes      | Which space to synthesize from. |
| `query`    | string | Yes      | What you want to learn.         |

**Response** `200 OK`

```json theme={null}
{
  "status": "complete",
  "insights": "Alice has progressed from junior to senior engineer over 6 years, specializing in distributed systems. She has taken on mentorship responsibilities recently.",
  "usage": {
    "input_tokens": 340,
    "output_tokens": 58
  }
}
```

```python theme={null}
answer = client.reason(
    space_id="customer-support-bot",
    query="What have we learned about Alice's career?",
)
print(answer)
```

`client.reason()` returns the synthesized string directly, or `None` when nothing was
found.

## How it works

Reason is read-only and never writes new memories. Internally it runs a multi-step pass:
retrieving relevant facts, expanding context through linked entities, and
cross-referencing related memories. Answer quality improves as more relevant memories
accumulate in the space.

## Error responses

| Status | Code           | Cause                                        |
| ------ | -------------- | -------------------------------------------- |
| 400    | `bad_request`  | Missing `query` or `space_id`.               |
| 401    | `unauthorized` | Missing or invalid API key.                  |
| 403    | `forbidden`    | The space is not owned by your organization. |
| 404    | `not_found`    | The space does not exist.                    |
| 429    | `rate_limited` | Credit quota or rate limit exceeded.         |

See the full [error reference](/api-reference/errors).

## Next steps

<CardGroup cols={2}>
  <Card title="Retrieve API" icon="magnifying-glass" href="/api-reference/retrieve">
    Query memories for specific information.
  </Card>

  <Card title="Chat" icon="comments" href="/api-reference/chat">
    OpenAI-compatible chat with memory built in.
  </Card>
</CardGroup>
