---
title: "Genai Search"
method: POST
path: "/agents/search"
tags: ["Agents"]
---

# Genai Search

`POST /agents/search`

## Request body

- AgentSearchReq — Query the `messages` table by content and/or span-level filters. Scans the `messages` table (one row per message occurrence, populated by an MV from spans) and returns matching span-level hits. Full-text search sets `query`; structured retrieval (e.g. all messages in a trace) leaves `query` empty and uses the filters below. The caller groups by conversation for the response shape.
  - `project_id` string, required
  - `query` string
  - `trace_id` string, nullable
  - `roles` string[], nullable
  - `conversation_id` string, nullable
  - `agent_name` string, nullable
  - `provider_name` string, nullable
  - `request_model` string, nullable
  - `truncate_content` boolean
  - `started_after` string, date-time, nullable
  - `started_before` string, date-time, nullable
  - `limit` integer
  - `offset` integer

## Response `200`

Successful Response

- AgentSearchRes — Response from a full-text search across agent messages.
  - `results` AgentSearchConversationResult[], required
    - `conversation_id` string, required
    - `conversation_name` string, required
    - `agent_name` string, required
    - `matched_messages` AgentSearchMatchedMessage[], required
      - `span_id` string, required
      - `trace_id` string, required
      - `role` '' | 'user' | 'assistant' | 'system' | 'tool' | 'tool_call' | 'tool_result', required
      - `content_preview` string, required
      - `content_digest` string, required
      - `started_at` string, date-time, required
    - `last_activity` string, date-time, required
  - `total_conversations` integer

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/wandb/apis/serverless-training.md) · [All operations](https://skmtc.net/wandb/apis/serverless-training/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/wandb/serverless-training/revisions/8d8d96fc0fd3/schema)
