---
title: "Update Test"
method: PATCH
path: "/v1/agent/tests/{test_id}"
tags: ["Agent Tests"]
---

# Update Test

`PATCH /v1/agent/tests/{test_id}`

## Request

- Base URL: `https://api.fish.audio`
- URL: `https://api.fish.audio/v1/agent/tests/{test_id}`
- Auth: HTTP bearer

Patch test fields. Omitted fields keep their value and null is rejected,
except `referenced_tool: null`, which turns a `tool` test into a check that
the agent calls no tool at all. Attach and detach agents with
`PUT` and `DELETE /v1/agent/agents/{agent_id}/tests/{test_id}`.

## Path parameters

- `test_id` string, required

## Request body

- PublicAgentTestUpdatePayload
  - `name` string, nullable
  - `test_type` 'next_reply' | 'tool' | 'simulation', nullable
  - `conversation` AgentTestMessagePayload[], nullable
    - `role` 'agent' | 'user', required
    - `text` string, required
  - `expectation` string, nullable
  - `success_examples` string[], nullable
  - `failure_examples` string[], nullable
  - `referenced_tool` AgentTestReferencedTool: Tool the runner should (or should not) observe on the next turn. A webhook or client tool is referenced by its library id, an integration tool by "<provider_key>:<tool_name>" (for example "google_calendar:create_event").
    - `id` string, required
    - `name` string, required
    - `type` 'webhook' | 'client' | 'integration'
    - `description` string
  - `tool_parameters` AgentTestToolParameter[], nullable
    - `name` string, required
    - `value` union, required
      - string
      - integer
      - number
      - boolean
    - `type` 'string' | 'number' | 'boolean', nullable
  - `verify_absence` boolean, nullable
  - `simulation` AgentTestSimulationConfig
    - `scenario` string, required
    - `max_turns` integer
    - `success_conditions` AgentTestSuccessCondition[], required
      - `name` string, required
      - `description` string, required
    - `assertions` AgentTestSimulationAssertions: Deterministic checks run before the judge, no LLM involved.
      - `tool_calls` AgentTestToolCallAssertion[]
        - `tool` AgentTestReferencedTool, required: Tool the runner should (or should not) observe on the next turn. A webhook or client tool is referenced by its library id, an integration tool by "<provider_key>:<tool_name>" (for example "google_calendar:create_event").
          - `id` string, required
          - `name` string, required
          - `type` 'webhook' | 'client' | 'integration'
          - `description` string
        - `params` object
        - `min_calls` integer
        - `max_calls` integer, nullable
      - `forbidden_tools` AgentTestReferencedTool[]
        - `id` string, required
        - `name` string, required
        - `type` 'webhook' | 'client' | 'integration'
        - `description` string
      - `ended_by` 'agent' | 'user' | 'transfer' | 'any', nullable
    - `tool_mocks` AgentTestToolMocks: all: every tool answers from a mock, except real_tools, which run for real. selected: only the listed tools do, the rest follow fallback. none: every tool hits its real endpoint.
      - `strategy` 'all' | 'selected' | 'none'
      - `fallback` 'error' | 'real'
      - `tools` AgentTestToolMock[]
        - `tool` AgentTestReferencedTool, required: Tool the runner should (or should not) observe on the next turn. A webhook or client tool is referenced by its library id, an integration tool by "<provider_key>:<tool_name>" (for example "google_calendar:create_event").
          - `id` string, required
          - `name` string, required
          - `type` 'webhook' | 'client' | 'integration'
          - `description` string
        - `result` unknown
        - `status` integer, nullable
        - `when` object, nullable
        - `error` boolean
      - `real_tools` AgentTestReferencedTool[]
        - `id` string, required
        - `name` string, required
        - `type` 'webhook' | 'client' | 'integration'
        - `description` string
    - `simulated_user_model` string, nullable
    - `repeat_count` integer
    - `channel` 'web_voice' | 'phone_inbound' | 'phone_outbound', nullable
    - `context` AgentTestSimulationContext: The run's platform context switches, the agent config's `context` section for a test. Off so a date pinned in the prompt holds.
      - `current_time` boolean
  - `dynamic_variables` object, nullable

## Response `200`

Request fulfilled, document follows

- object
  - `test_id` string, required
  - `workspace_id` string, required
  - `name` string, required
  - `test_type` 'next_reply' | 'tool' | 'simulation', required
  - `agent_ids` string[]: Agents this test is attached to.
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `conversation` PublicAgentTestMessage[]
    - `role` 'agent' | 'user', required
    - `text` string, required
  - `expectation` string
  - `success_examples` string[]
  - `failure_examples` string[]
  - `referenced_tool` AgentTestReferencedTool: Tool the runner should (or should not) observe on the next turn. A webhook or client tool is referenced by its library id, an integration tool by "<provider_key>:<tool_name>" (for example "google_calendar:create_event").
    - `id` string, required
    - `name` string, required
    - `type` 'webhook' | 'client' | 'integration'
    - `description` string
  - `tool_parameters` AgentTestToolParameter[]
    - `name` string, required
    - `value` union, required
      - string
      - integer
      - number
      - boolean
    - `type` 'string' | 'number' | 'boolean', nullable
  - `verify_absence` boolean
  - `simulation` AgentTestSimulationConfig
    - `scenario` string, required
    - `max_turns` integer
    - `success_conditions` AgentTestSuccessCondition[], required
      - `name` string, required
      - `description` string, required
    - `assertions` AgentTestSimulationAssertions: Deterministic checks run before the judge, no LLM involved.
      - `tool_calls` AgentTestToolCallAssertion[]
        - `tool` AgentTestReferencedTool, required: Tool the runner should (or should not) observe on the next turn. A webhook or client tool is referenced by its library id, an integration tool by "<provider_key>:<tool_name>" (for example "google_calendar:create_event").
          - `id` string, required
          - `name` string, required
          - `type` 'webhook' | 'client' | 'integration'
          - `description` string
        - `params` object
        - `min_calls` integer
        - `max_calls` integer, nullable
      - `forbidden_tools` AgentTestReferencedTool[]
        - `id` string, required
        - `name` string, required
        - `type` 'webhook' | 'client' | 'integration'
        - `description` string
      - `ended_by` 'agent' | 'user' | 'transfer' | 'any', nullable
    - `tool_mocks` AgentTestToolMocks: all: every tool answers from a mock, except real_tools, which run for real. selected: only the listed tools do, the rest follow fallback. none: every tool hits its real endpoint.
      - `strategy` 'all' | 'selected' | 'none'
      - `fallback` 'error' | 'real'
      - `tools` AgentTestToolMock[]
        - `tool` AgentTestReferencedTool, required: Tool the runner should (or should not) observe on the next turn. A webhook or client tool is referenced by its library id, an integration tool by "<provider_key>:<tool_name>" (for example "google_calendar:create_event").
          - `id` string, required
          - `name` string, required
          - `type` 'webhook' | 'client' | 'integration'
          - `description` string
        - `result` unknown
        - `status` integer, nullable
        - `when` object, nullable
        - `error` boolean
      - `real_tools` AgentTestReferencedTool[]
        - `id` string, required
        - `name` string, required
        - `type` 'webhook' | 'client' | 'integration'
        - `description` string
    - `simulated_user_model` string, nullable
    - `repeat_count` integer
    - `channel` 'web_voice' | 'phone_inbound' | 'phone_outbound', nullable
    - `context` AgentTestSimulationContext: The run's platform context switches, the agent config's `context` section for a test. Off so a date pinned in the prompt holds.
      - `current_time` boolean
  - `dynamic_variables` object

## Other responses

- `401`: No permission -- see authorization schemes
- `404`: Nothing matches the given URI
- `422`
- `503`: The server cannot process the request due to a high load

## Changes

- **2026-11-03** `42ac421f7a12`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/fish/apis/fishaudio-openapi/changes/v1/agent/tests/:test_id/patch.md)

---

[API](https://skmtc.dev/fish/apis/fishaudio-openapi.md) - [All operations](https://skmtc.dev/fish/apis/fishaudio-openapi/llms.txt) - [OpenAPI document](https://skmtc.dev/fish/apis/fishaudio-openapi/revisions/42ac421f7a12?raw)
