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

# Search memories

> Retrieve relevant memories for a user query

<ParamField path="agent_id" type="integer" required>
  Agent ID.
</ParamField>

<ParamField body="agent_user_id" type="integer" required>
  Agent user whose memories should be searched.
</ParamField>

<ParamField body="query" type="string" required>
  Search query.
</ParamField>

<ParamField body="top_k" type="integer">
  Number of results. Defaults to `5`.
</ParamField>

## SDK

<CodeGroup>
  ```typescript TypeScript theme={null}
  await client.memories.search(7, 42, "preferred language", 5);
  ```

  ```python Python theme={null}
  await client.memories.search(7, 42, "preferred language", top_k=5)
  ```
</CodeGroup>
