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

# Memory

> Manage agent and user memories with the Python SDK

Use `client.memories` for Agent memory and per-user memory.

## Create and list Agent memory

```python theme={null}
from chatatp_studio import ChatATPClient

async with ChatATPClient(api_key="chatatp_sk_...") as client:
    memory = await client.memories.create(
        7,
        title="Preferred response style",
        content="The user prefers concise answers.",
        memory_type="preference",
        importance=1.0,
    )
    memories = await client.memories.list(7)
```

Memory indexing is asynchronous. Inspect each memory's `status`, `chunk_count`, and `error_message`.

## Per-user memory and search

```python theme={null}
await client.memories.create(
    7,
    title="Subscription plan",
    content="The user is on the Pro plan.",
    agent_user_id=42,
    memory_type="fact",
)

result = await client.memories.search(
    7,
    42,
    "What plan is the user on?",
    top_k=5,
)
print(result["context"], result["has_context"])
```

For the equivalent Studio CLI workflow, see the Memory section in the [CLI overview](/docs/docs/cli/overview).
