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

# Search the agent's notes

> Word and tag search over the notes the agent may read.



## OpenAPI

````yaml openapi/en/cell.json POST /v1/agent-memory/search
openapi: 3.1.0
info:
  title: Niadra data API
  version: '1'
  description: >-
    Writing, context, history, objects, identity, privacy and governance of one
    space. Every space has a stable address, with the space and the region in
    its name.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: The space, which comes in the source key.
      region:
        default: us-east-2
        description: The region of the space, which also comes in the key.
security: []
paths:
  /v1/agent-memory/search:
    post:
      tags:
        - agent-memory
      summary: Search the agent's notes
      description: >-
        Searches by words and tags the notes the agent may read; no vector,
        because an agent holds tens to hundreds of notes. Leaves an
        `agent_memory` receipt.


        **Authentication.** Source key with the `agent_memory` or `context`
        scope, or a Console person token with the `integration` role (or admin).
      operationId: search_v1_agent_memory_search_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentMemorySearchRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentMemorySearchResponse'
          description: The matching notes, best first.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The request does not match the contract.
      security:
        - sourceKey: []
        - personToken: []
      x-codeSamples:
        - lang: python
          label: Python
          source: >-
            for note in niadra.search_agent_memory("reschedule a technician
            visit", tags=["scheduling"]):
                print(note.kind, note.title, note.body)
        - lang: typescript
          label: TypeScript
          source: >-
            const { data } = await niadra.searchAgentMemory({ query: "reschedule
            a technician visit", tags: ["scheduling"] });

            for (const note of data?.notes ?? []) console.log(note.kind,
            note.title, note.body);
components:
  schemas:
    AgentMemorySearchRequest:
      additionalProperties: false
      properties:
        conversation_id:
          anyOf:
            - maxLength: 512
              minLength: 1
              type: string
            - type: 'null'
          description: For the receipt; never stored in a note.
          title: Conversation Id
        limit:
          default: 5
          maximum: 20
          minimum: 1
          title: Limit
          type: integer
        query:
          maxLength: 500
          minLength: 1
          title: Query
          type: string
        tags:
          items:
            pattern: ^[a-z0-9][a-z0-9_.:-]{0,63}$
            type: string
          maxItems: 8
          title: Tags
          type: array
        task_id:
          anyOf:
            - maxLength: 512
              minLength: 1
              type: string
            - type: 'null'
          title: Task Id
      required:
        - query
      title: AgentMemorySearchRequest
      type: object
    AgentMemorySearchResponse:
      additionalProperties: false
      properties:
        notes:
          items:
            $ref: '#/components/schemas/AgentNote'
          title: Notes
          type: array
      required:
        - notes
      title: AgentMemorySearchResponse
      type: object
    Problem:
      additionalProperties: false
      description: RFC 9457 problem details; `code` comes from the versioned error catalog.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
    AgentNote:
      additionalProperties: false
      properties:
        body:
          title: Body
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
        created_by:
          description: '`source:<id>` or `user:<id>`.'
          title: Created By
          type: string
        evidence:
          anyOf:
            - $ref: '#/components/schemas/Evidence'
            - type: 'null'
        kind:
          $ref: '#/components/schemas/AgentNoteKind'
        note_id:
          format: uuid
          title: Note Id
          type: string
        origin:
          $ref: '#/components/schemas/AgentNoteOrigin'
        source_id:
          description: The agent that owns the note.
          format: uuid
          title: Source Id
          type: string
        status:
          $ref: '#/components/schemas/AgentNoteStatus'
        supersedes_note_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: The version this one replaced; that one is `retired`.
          title: Supersedes Note Id
        tags:
          items:
            type: string
          title: Tags
          type: array
        title:
          title: Title
          type: string
        valid_until:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: After this moment the note leaves the block and the search.
          title: Valid Until
        version:
          minimum: 1
          title: Version
          type: integer
        visibility:
          $ref: '#/components/schemas/AgentNoteVisibility'
      required:
        - note_id
        - source_id
        - visibility
        - kind
        - title
        - body
        - origin
        - version
        - status
        - created_at
        - created_by
      title: AgentNote
      type: object
    Evidence:
      additionalProperties: false
      description: >-
        Where the note came from: an id only, never the text of the conversation
        or task.
      properties:
        conversation_id:
          anyOf:
            - maxLength: 512
              minLength: 1
              type: string
            - type: 'null'
          title: Conversation Id
        task_id:
          anyOf:
            - maxLength: 512
              minLength: 1
              type: string
            - type: 'null'
          title: Task Id
      title: Evidence
      type: object
    AgentNoteKind:
      enum:
        - procedure
        - tool_note
        - process_note
        - pitfall
      title: AgentNoteKind
      type: string
    AgentNoteOrigin:
      enum:
        - agent
        - human
        - distilled
      title: AgentNoteOrigin
      type: string
    AgentNoteStatus:
      enum:
        - active
        - retired
      title: AgentNoteStatus
      type: string
    AgentNoteVisibility:
      enum:
        - source
        - vendor
        - space
      title: AgentNoteVisibility
      type: string
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...
    personToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````