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

# Search an agent's memory

> Searches this agent's namespace, best first. Ranks entries by relevance, combining keyword (BM25) matches, including the last query word as a prefix, plus semantic matches within a fixed vector-distance cutoff, fused by reciprocal rank. Unrelated entries are dropped rather than filling `limit`, so fewer hits than `limit` is normal. Queries under 3 characters use keyword matching only. Results are capped by `limit` and have no cursor. Agent leases cannot call this route; agents use the `memory.search` tool. Returns 503 `memory_search_unavailable` when search is not configured or the search provider fails.



## OpenAPI

````yaml /openapi/platform.v1.json get /v1/agents/{agentId}/memory/search
openapi: 3.0.3
info:
  description: Public platform API for catalog and proxied data-plane routes.
  title: Matrices Platform API
  version: v1
servers:
  - url: https://api.matrices.com
security: []
tags:
  - description: Authenticated bearer credential context.
    name: auth
    x-group: Auth
  - description: Write-only provider credentials with safe connection metadata.
    name: connections
    x-group: Connections
  - description: Materialized workspace principals and active agent counts.
    name: identities
    x-group: Identities
  - description: Remote MCP server registrations.
    name: toolsets
    x-group: Toolsets
  - description: Named allow-only agent tool permissions.
    name: roles
    x-group: Roles
  - description: Client-executed tool calls.
    name: tools
    x-group: Tools
  - description: Reusable agent behavior profiles.
    name: profiles
    x-group: Profiles
  - description: Workspace-owned agent identities.
    name: agents
    x-group: Agents
  - description: Durable inbound file uploads.
    name: files
    x-group: Files
  - description: Immutable private image inputs.
    name: images
    x-group: Images
  - description: Public model catalog.
    name: models
    x-group: Models
  - description: Running agent threads.
    name: threads
    x-group: Threads
  - description: Agent schedules.
    name: schedules
    x-group: Schedules
  - description: Workspace append-only feeds.
    name: feeds
    x-group: Feeds
  - description: Agent subscriptions over workspace feeds.
    name: subscriptions
    x-group: Subscriptions
  - description: Workspace and identity-scoped skill bundles.
    name: plugins
    x-group: Plugins
  - description: Agent-private and workspace-shared durable memory notes.
    name: memory
    x-group: Memory
  - description: Thread messages.
    name: messages
    x-group: Messages
  - description: Thread event log data.
    name: events
    x-group: Events
  - description: Runtime hook audit and wait resolution.
    name: hooks
    x-group: Hooks
paths:
  /v1/agents/{agentId}/memory/search:
    get:
      tags:
        - memory
      summary: Search an agent's memory
      description: >-
        Searches this agent's namespace, best first. Ranks entries by relevance,
        combining keyword (BM25) matches, including the last query word as a
        prefix, plus semantic matches within a fixed vector-distance cutoff,
        fused by reciprocal rank. Unrelated entries are dropped rather than
        filling `limit`, so fewer hits than `limit` is normal. Queries under 3
        characters use keyword matching only. Results are capped by `limit` and
        have no cursor. Agent leases cannot call this route; agents use the
        `memory.search` tool. Returns 503 `memory_search_unavailable` when
        search is not configured or the search provider fails.
      operationId: SearchAgentMemory
      parameters:
        - $ref: '#/components/parameters/AgentID'
        - $ref: '#/components/parameters/MemorySearchQuery'
        - $ref: '#/components/parameters/MemorySearchLimit'
        - $ref: '#/components/parameters/MemorySearchSnippetRunes'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MemorySearchResponse'
          description: Ranked memory hits.
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '502':
          $ref: '#/components/responses/RuntimeUpstreamError'
        '503':
          $ref: '#/components/responses/RuntimeUnavailable'
      security:
        - APIKeyBearer: []
components:
  parameters:
    AgentID:
      in: path
      name: agentId
      required: true
      schema:
        type: string
    MemorySearchQuery:
      description: Search text, 1–1024 bytes after trimming whitespace.
      in: query
      name: query
      required: true
      schema:
        minLength: 1
        type: string
    MemorySearchLimit:
      description: Maximum hits to return.
      in: query
      name: limit
      required: false
      schema:
        default: 10
        maximum: 50
        minimum: 1
        type: integer
    MemorySearchSnippetRunes:
      description: >-
        Maximum characters (Unicode code points) in each hit's snippet,
        including any `…` marking a cut.
      in: query
      name: snippetRunes
      required: false
      schema:
        default: 300
        maximum: 300
        minimum: 80
        type: integer
  schemas:
    MemorySearchResponse:
      properties:
        hits:
          items:
            $ref: '#/components/schemas/MemorySearchHit'
          type: array
      required:
        - hits
      type: object
    MemorySearchHit:
      properties:
        key:
          type: string
        snippet:
          description: >-
            At most `snippetRunes` characters (300 by default) of the entry's
            text around the first keyword match, or from the start when the
            entry matched by meaning only. Cuts land on a word boundary when one
            is near and are marked with `…`.
          type: string
        updatedAt:
          format: date-time
          type: string
        version:
          type: string
      required:
        - key
        - version
        - updatedAt
        - snippet
      type: object
    ErrorResponse:
      properties:
        attemptsRemaining:
          type: integer
        code:
          type: string
        error:
          type: string
        message:
          type: string
        retryAfterSeconds:
          type: integer
      required:
        - error
        - message
      type: object
  responses:
    BadRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: Invalid request.
    NotFound:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: Resource not found.
    RuntimeUpstreamError:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: Runtime environment returned an upstream error.
    RuntimeUnavailable:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: Runtime environment is unavailable or cannot be selected.
  securitySchemes:
    APIKeyBearer:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.