---
title: "Search the golden set"
method: POST
path: "/api/agent-examples/search"
tags: ["agent_examples"]
---

# Search the golden set

`POST /api/agent-examples/search`

## Request

- Base URL: `https://beta.getsales.io/unibox/v1`
- URL: `https://beta.getsales.io/unibox/v1/api/agent-examples/search`
- Auth: HTTP bearer and API key in header `Team-SID`

The AI SDR's Golden set: every kept dialogue, with counts by tier, kind, source, scenario, sender profile and who kept it (golden_by), and the edits waiting for a Keep (filter proposed). filter.q finds a dialogue by what was said; sort used_count desc orders by the replies it was read before. mode semantic lists the rows nearest to the text in filter.q the way the agent picks them, each with its similarity. page_size 0 returns counts alone.

Contract:
- MCP tool `search_agent_examples`, registry package `mcp.unibox/agent_examples`, mount `unibox.agent-memory`.
- Operation `search`, response envelope `search`.
- Flags: read only.

## Request body

- SearchAgentExamplesRequest: Request body of `search_agent_examples`.
  - `filter` object: Field filters, ANDed: {field: {eq | ne | in | nin | gte | lte | gt | lt | is_null}}; q inside it is free text. Omit for every row.
    - `q` string: Free text over the situation, the answer and the note (forget takes it too); in mode semantic, the situation to match, required there.
    - `sid` object: Row sid(s), ub_eg_ prefix.
      - `eq` string: Golden set row sid (ub_eg_…).
      - `in` string[]
    - `agent_sid` object: Whose Golden set (ub_ag_…, block 10, 2026-10-30); left out, the team's default agent's.
      - `eq` string
    - `sender_profile_sid` object: What one sender profile's replies taught (ub_sp_…); { is_null: true } for the pairs typed by hand.
      - `eq` string
      - `in` string[]
      - `is_null` boolean
    - `conversation_sid` object: The rows read from one thread (ub_cv_…).
      - `eq` string
      - `in` string[]
    - `message_sid` object: Whether a message is in the set already (ub_ms_…).
      - `eq` string
      - `in` string[]
    - `document_sid` object: The dialogues kept from one conversations upload (ub_cu_…); { is_null: true } for every other source.
      - `eq` string
      - `in` string[]
      - `is_null` boolean
    - `tier` object: { eq: "golden" } is what people vouched for.
      - `eq` 'golden' | 'auto'
      - `in` string[]
    - `source` object: Where the rows came from.
      - `eq` 'history' | 'own_send' | 'approved_edit' | 'remembered' | 'document' | 'manual'
      - `in` string[]
    - `kind` object: reply or followup; mode semantic takes a plain value.
      - `eq` 'reply' | 'followup'
      - `in` string[]
    - `channel` object: The channel the answers went on; mode semantic takes a plain value and adds the rows with none.
      - `eq` 'linkedin' | 'email'
      - `in` string[]
      - `is_null` boolean
    - `scenario_key` object: The classified scenario of the situation.
      - `eq` string
      - `in` string[]
      - `is_null` boolean
    - `embedding_state` object: { eq: "failed" } lists the rows whose vector could not be written.
      - `eq` 'pending' | 'ready' | 'failed'
      - `in` string[]
    - `proposed` object: true: the edits waiting for a Keep (From your edits); false: the rows in the set.
      - `eq` boolean
      - `ne` boolean
    - `golden_by` object: Who kept the row, by the actor sid in its golden_by identity (us_mb_… for a member); { is_null: true } for the rows nobody kept by hand (block AC5).
      - `eq` string
      - `in` string[]
      - `is_null` boolean
    - `answered_at` object: ISO 8601 range of when the answers went out.
      - `gte` string
      - `lte` string
      - `gt` string
      - `lt` string
    - `created_at` object: ISO 8601 range.
      - `gte` string
      - `lte` string
      - `gt` string
      - `lt` string
    - `deleted_at` object: Default scope is the live rows; forgotten ones stay out of every read.
      - `is_null` boolean
  - `include` string[]: Relations to attach to every item; omit for the bare rows.
  - `sort` object: One column and its direction; omit for the default order.
    - `field` 'created_at' | 'answered_at' | 'used_count' | 'last_used_at' | 'seen_count' | 'golden_at', required: The column to order by.
    - `direction` 'asc' | 'desc': asc or desc; default desc.
  - `page_size` integer: 0..500, default 50; 0 = counts only, 1 = the first row.
  - `cursor` string, nullable: pagination.next_cursor of the previous page.
  - `mode` 'words' | 'semantic': words (default): the list with its counts, q as free text; semantic: the rows nearest to the situation in filter.q, as the agent's pick reads them, up to 50, each with its similarity, no cursor.

## Response `200`

`search` success envelope.

- SearchAgentExamplesResponse
  - `success` true, required
  - `operation` 'search', required
  - `items` object[], required
    - `item` object, required
      - `sid` string, required: Golden set row sid (ub_eg_…).
      - `team_sid` string, required: Owning team (ts_tm_…, external - gs.service.id).
      - `agent_sid` string, nullable, required: The AI SDR whose Golden set the row is in (ub_ag_…, block 10, 2026-10-30); null on a row from before, read as the team's default's.
      - `tier` 'golden' | 'auto', required: golden: a person vouched for it (Remember, a pair by hand, a Keep, a promotion), picked ahead; auto: learned by rule from the team's own sends.
      - `source` 'history' | 'own_send' | 'approved_edit' | 'remembered' | 'document' | 'manual', required: history (the history walk's harvest), own_send (a person's reply in a live thread), approved_edit (an agent draft a person edited), remembered, manual (a pair typed by hand), document (kept from a conversations upload, block AC5).
      - `kind` 'reply' | 'followup', required: reply: the team's answer to the lead's message; followup: our message after the lead went quiet.
      - `situation` string, required: What the answer responds to: the lead's message(s), or our unanswered message for a follow-up. Names are placeholders: {lead}, {lead_company}, {sender}.
      - `answer` string, required: The team's answer as it went out (or as the person wrote it), names as placeholders.
      - `sender_profile_sid` string, nullable, required: The sender profile that answered (ub_sp_…); null on a pair typed by hand.
      - `conversation_sid` string, nullable, required: The thread the pair was read from (ub_cv_…); null on a pair typed by hand.
      - `message_sid` string, nullable, required: The outbound message the answer is (ub_ms_…); one row per message. Null on a pair typed by hand.
      - `document_sid` string, nullable, required: The conversations upload the dialogue was kept from (ub_cu_…, block AC5); null on every other source.
      - `channel` 'linkedin' | 'email', nullable, required: The channel the answer went on; null on a pair typed by hand (read on every channel).
      - `scenario_key` string, nullable, required: The classified scenario of the situation (interested, objection, ...) when known.
      - `context_before` string, nullable, required: Our message before the lead's, the context the situation reads against; null on a follow-up.
      - `draft_text` string, nullable, required: approved_edit only: the agent's draft before the person's edit, beside the answer they sent.
      - `note` string, nullable, required: A person's note on when the row applies, max 512 chars.
      - `seen_count` integer, required: How often the same answer was met across the team's threads.
      - `used_count` integer, required: How many agent turns the row was shown to.
      - `last_used_at` string, nullable, required: ISO 8601 UTC of the last turn that read it; null when none did.
      - `answered_at` string, nullable, required: ISO 8601 UTC, when the answer went out.
      - `embedding_state` 'pending' | 'ready' | 'failed', required: pending until the vector is written, ready when the pick can read it, failed after three tries (an edit of the situation sends it back to pending).
      - `embedding_model` string, nullable, required: provider/model that wrote the vector; null while pending.
      - `golden_by` object, nullable, required: Who made the row golden; null on an auto row.
        - `actor_type` 'user' | 'support' | 'api_key' | 'system' | 'agent', required
        - `actor_sid` string, nullable, required
        - `team_sid` string, required
        - `actor_name` string, nullable: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
        - `oauth_client_sid` string, nullable: The acting OAuth client (id_oc_*); null off the OAuth path.
        - `reason` string, nullable: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
        - `permissions` object, required: Internal audit context: the grant set the actor held at write time. Not a contract.
        - `cluster_id` integer, nullable: Internal audit context: the cluster that served the write.
        - `trace_id` string, nullable: Internal audit context: the trace id of the request that wrote the row.
      - `golden_at` string, nullable, required: ISO 8601 UTC, when it became golden; null on an auto row.
      - `proposed_at` string, nullable, required: Set while an edited draft waits for a person's Keep (From your edits): such a row is never picked. Null once in the set.
      - `created_by` object, required: The actor whose write bore the row (the system for the harvest).
        - `actor_type` 'user' | 'support' | 'api_key' | 'system' | 'agent', required
        - `actor_sid` string, nullable, required
        - `team_sid` string, required
        - `actor_name` string, nullable: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
        - `oauth_client_sid` string, nullable: The acting OAuth client (id_oc_*); null off the OAuth path.
        - `reason` string, nullable: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
        - `permissions` object, required: Internal audit context: the grant set the actor held at write time. Not a contract.
        - `cluster_id` integer, nullable: Internal audit context: the cluster that served the write.
        - `trace_id` string, nullable: Internal audit context: the trace id of the request that wrote the row.
      - `deleted_by` object, nullable, required: Who forgot it; null on a live row.
        - `actor_type` 'user' | 'support' | 'api_key' | 'system' | 'agent', required
        - `actor_sid` string, nullable, required
        - `team_sid` string, required
        - `actor_name` string, nullable: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
        - `oauth_client_sid` string, nullable: The acting OAuth client (id_oc_*); null off the OAuth path.
        - `reason` string, nullable: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
        - `permissions` object, required: Internal audit context: the grant set the actor held at write time. Not a contract.
        - `cluster_id` integer, nullable: Internal audit context: the cluster that served the write.
        - `trace_id` string, nullable: Internal audit context: the trace id of the request that wrote the row.
      - `created_at` string, required: ISO 8601 UTC.
      - `updated_at` string, required: ISO 8601 UTC.
      - `deleted_at` string, nullable, required: ISO 8601 UTC once forgotten; null on a live row.
    - `included` object, required
      - `similarity` number: mode semantic only: how near the row is to the text searched, (1 + cosine) / 2, best first.
      - `used_30d` integer: include usage: the agent turns that read the row in the last 30 days (used_count on the row counts every turn).
      - `last_uses` object[]: include usage: the newest three turns that read the row, whatever their age, newest first.
        - `at` string, nullable, required: ISO 8601 UTC of the turn.
        - `conversation_sid` string, required: The thread it wrote on (ub_cv_…).
        - `run_sid` string, required: The turn (ub_rn_…): get_agent_run reads how the reply was made.
        - `run_outcome` string, nullable, required: What became of that reply (AgentRunOutcomeEnum: written, edited, unsure, waiting, handed, test); null while none.
        - `lead_name` string, nullable, required: The lead of that thread.
        - `outcome` object, nullable, required: What happened on that thread after the reply; null when the thread is gone.
          - `kind` string, required: booked, signed_up, registered (the Playbook's end), their_link, confirmed_time, gave_contact (the lead's own evidence), handed (a person took the thread), replied (the lead wrote again), back_on (the lead named a date and the plan waits until it: at is the date), no_reply.
          - `at` string, nullable, required: ISO 8601 UTC of what happened; null on no_reply.
      - `lead_name` string, nullable: include thread: the lead of the thread the pair was read from (or the lead the upload named); null on a pair typed by hand.
      - `lead_company` string, nullable: include thread: the lead's company, from the linked person or the upload; null when unknown.
      - `sender_profile_name` string, nullable: include thread: the sender profile whose person answered; null on a pair typed by hand or uploaded.
      - `dialogue` object: include dialogue (get only): the whole dialogue around the kept reply and what the agent takes from it.
        - `channel` string, nullable, required: linkedin or email; null on a dialogue typed by hand with no channel.
        - `origin` object, required
          - `kind` string, required: workflow (a workflow's message opened the thread), person (a person's own first touch), lead (the lead wrote first), history (the history walk), upload (a conversations upload), typed (a pair typed by hand).
          - `workflow_name` string, nullable, required: The workflow, when one opened the thread.
          - `ordinal` integer, nullable, required: Our message before the kept reply counted among our messages on the thread, from 1 ("from the workflow's message 2").
        - `before` object, nullable, required: Our message before the lead's; null when the lead wrote first.
          - `message_sid` string, nullable, required: The message (ub_ms_…); null on a dialogue typed by hand or uploaded.
          - `author` string, required: person (a person wrote it), agent (the AI SDR's draft went out), workflow (a workflow's message).
          - `author_name` string, nullable, required: The sender profile whose person wrote it.
          - `text` string, required: The message as it went out.
          - `at` string, nullable, required: ISO 8601 UTC.
        - `theirs` object, nullable, required: What they wrote; null on a follow-up to our own unanswered message.
          - `message_sid` string, nullable, required
          - `text` string, required: The lead's message(s) the reply answered, as written (several joined by a blank line).
          - `at` string, nullable, required
        - `kept` object, required: The kept reply.
          - `message_sid` string, nullable, required: The message (ub_ms_…); null on a dialogue typed by hand or uploaded.
          - `author` string, required: person (a person wrote it), agent (the AI SDR's draft went out), workflow (a workflow's message).
          - `author_name` string, nullable, required: The sender profile whose person wrote it.
          - `text` string, required: The message as it went out.
          - `at` string, nullable, required: ISO 8601 UTC.
          - `draft_text` string, nullable, required: The agent's draft before the person's edit; null when the reply went as drafted or a person wrote it.
          - `edits` object[], nullable, required: The edit against the draft, word by word, in order; null when there was no draft to mark against.
            - `op` string, required: equal (both texts), del (the draft's own words, struck), ins (the person's own, written).
            - `text` string, required
        - `next` object, nullable, required: The lead's next message after the kept reply; null when none came.
          - `message_sid` string, nullable, required
          - `text` string, required
          - `at` string, nullable, required
        - `outcome` object, nullable, required: What happened after the kept reply; null on a dialogue with no thread.
          - `kind` string, required: booked, signed_up, registered (the Playbook's end), their_link, confirmed_time, gave_contact (the lead's own evidence), handed (a person took the thread), replied (the lead wrote again), back_on (the lead named a date and the plan waits until it: at is the date), no_reply.
          - `at` string, nullable, required: ISO 8601 UTC of what happened; null on no_reply.
        - `takes` object, required: What the agent takes from the reply, read by rule: the length, the ask, the register, the number.
          - `words` integer, required: The kept reply's words.
          - `sentences` integer, required: Its sentences.
          - `ask` object, required
            - `kind` string, required: time_slots (times or days offered), question, link (a booking link), none.
            - `count` integer, required: The slots or questions counted.
            - `question_before` boolean, required: Whether a question stands before the ask that ends it.
          - `register` object, required
            - `kind` string, required: du, sie (the German registers), first_name (the lead addressed by name), formal, unknown.
            - `as_they_wrote` boolean, nullable, required: Whether the register matches the lead's own; null when either side cannot be read.
          - `number` object, required
            - `kind` string, required: exact (one figure), range, none.
            - `text` string, nullable, required: The figure as written ("627 EUR a month").
  - `pagination` object, required
    - `next_cursor` string, nullable, required
    - `has_more` boolean, required
    - `total_count` integer, nullable, required
  - `applied_filters` object, required
  - `includes` string[], required
  - `meta` object, required
    - `trace_id` string, required: UUID v7; same 128-bit value as the X-Trace-Id header.
    - `span_id` string, required: 16 hex chars, root span of this request.
    - `timestamp` string, required: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
    - `duration_ms` integer, required: Server-side wall clock.
    - `team_sid` string, nullable: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
    - `actor_type` string, nullable: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
  - `counts` object
    - `total_count` integer, required: Rows matching the filter (full filter scope, not the page).
    - `groups` object, required
      - `tier` union, required: Rows by tier (golden, auto); an absent key means zero.
        - object
        - unknown[]
          - unknown
      - `kind` union, required: Rows by kind (reply, followup).
        - object
        - unknown[]
          - unknown
      - `source` union, required: Rows by source.
        - object
        - unknown[]
          - unknown
      - `scenario_key` union, required: Rows by scenario key, __null for the rows with none.
        - object
        - unknown[]
          - unknown
      - `sender_profile_sid` union, required: Rows by sender profile, __null for the pairs typed by hand.
        - object
        - unknown[]
          - unknown
      - `golden_by` union, required: Rows by who kept them (the actor sid of golden_by), __null for the rows nobody kept by hand (block AC5).
        - object
        - unknown[]
          - unknown
      - `proposed` union, required: true: the edits waiting for a Keep (From your edits); false: the rows in the set.
        - object
        - unknown[]
          - unknown

## Other responses

- `4XX`: MCP error envelope. `error.code` is one of validation_failed, nothing_to_update, not_found, relation_not_found, invalid_transition, limit_exceeded, payment_required, duplicate_rejected, conflict, delete_blocked, unauthorized, forbidden, rate_limited, not_implemented.
- `5XX`: MCP error envelope with `error.code` internal_error or service_unavailable.

---

[API](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox.md) - [All operations](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox/llms.txt) - [OpenAPI document](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox/revisions/8f1bc317897f?raw)
