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

# Create Voice Agent Test

> Create a Single Turn, Tool or Simulation test, optionally attached to agents.



## OpenAPI

````yaml post /v1/agent/tests
openapi: 3.1.0
info:
  title: FishAudio OpenAPI
  version: '1'
servers:
  - description: Fish Audio API
    url: https://api.fish.audio
security: []
tags: []
paths:
  /v1/agent/tests:
    post:
      tags:
        - Agent Tests
      summary: Create Test
      description: >-
        Create a test: `next_reply` judges the agent's next reply against an

        expectation, `tool` checks the tool the agent calls next, and
        `simulation`

        lets a simulated user hold a whole conversation that is scored against

        success conditions. Pass `agent_ids` to attach the test right away.

        `channel` sets the channel a `next_reply` or `tool` test plays.


        The body of `GET /v1/agent/tests/{test_id}` posts back as is, so tests
        can

        be exported and imported. Tool references use your workspace's tool ids

        (list them with `GET /v1/agent/agents/{agent_id}/test-tools`), so an
        export

        imports cleanly within the same team and needs its tool ids remapped

        elsewhere. System tools go by their tool name, the same in every team.

        `folder_id` puts the test in a test folder of the workspace it is
        created

        in. An id that is no folder there, as in an export from another team, is

        ignored and the test is created outside any folder.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublicAgentTestCreatePayload'
      responses:
        '201':
          description: Document created, URL follows
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  test_id:
                    title: Test Id
                    type: string
                  workspace_id:
                    title: Workspace Id
                    type: string
                  name:
                    title: Name
                    type: string
                  test_type:
                    enum:
                      - next_reply
                      - tool
                      - simulation
                    title: Test Type
                    type: string
                  folder_id:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    description: >-
                      The test folder the test is in (`/v1/agent/test-folders`),
                      null outside any folder.
                    title: Folder Id
                  agent_ids:
                    description: Agents this test is attached to.
                    items:
                      type: string
                    title: Agent Ids
                    type: array
                  created_at:
                    format: date-time
                    title: Created At
                    type: string
                  updated_at:
                    format: date-time
                    title: Updated At
                    type: string
                  conversation:
                    items:
                      $ref: '#/components/schemas/PublicAgentTestMessage'
                    title: Conversation
                    type: array
                  expectation:
                    default: ''
                    title: Expectation
                    type: string
                  success_examples:
                    items:
                      type: string
                    title: Success Examples
                    type: array
                  failure_examples:
                    items:
                      type: string
                    title: Failure Examples
                    type: array
                  referenced_tool:
                    anyOf:
                      - $ref: '#/components/schemas/AgentTestReferencedTool'
                      - type: 'null'
                    default: null
                  tool_parameters:
                    items:
                      $ref: '#/components/schemas/AgentTestToolParameter'
                    title: Tool Parameters
                    type: array
                  verify_absence:
                    default: false
                    title: Verify Absence
                    type: boolean
                  simulation:
                    anyOf:
                      - $ref: '#/components/schemas/AgentTestSimulationConfig'
                      - type: 'null'
                    default: null
                  channel:
                    anyOf:
                      - enum:
                          - web_voice
                          - phone_inbound
                          - phone_outbound
                        type: string
                      - type: 'null'
                    default: null
                    description: >-
                      The channel a Single Turn or Tool test plays. null is
                      web_voice. A Simulation test has its own in
                      simulation.channel.
                    title: Channel
                  dynamic_variables:
                    additionalProperties:
                      anyOf:
                        - type: string
                        - type: integer
                        - type: number
                        - type: boolean
                    title: Dynamic Variables
                    type: object
                  judge:
                    anyOf:
                      - $ref: '#/components/schemas/AgentTestJudge'
                      - type: 'null'
                    default: null
                    description: >-
                      The judge of a `next_reply` or `simulation` test. Null
                      follows the workspace's Tests settings (`GET
                      /v1/agent/test-settings`). A `tool` test has no judge, it
                      is null there.
                required:
                  - test_id
                  - workspace_id
                  - name
                  - test_type
                  - created_at
                  - updated_at
                type: object
        '400':
          description: Bad request syntax or unsupported method
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '401':
          description: No permission -- see authorization schemes
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '422':
          description: ''
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '503':
          description: The server cannot process the request due to a high load
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: bash
          label: Create Simulation Test
          source: |-
            curl --request POST \
              --url https://api.fish.audio/v1/agent/tests \
              --header 'Authorization: Bearer <token>' \
              --header 'Content-Type: application/json' \
              --data '{
                "name": "Reschedules an appointment",
                "test_type": "simulation",
                "agent_ids": ["<agent-id>"],
                "simulation": {
                  "scenario": "You are Jane. Move your Tuesday cleaning to Thursday afternoon.",
                  "max_turns": 10,
                  "success_conditions": [
                    {"name": "rescheduled", "description": "The agent confirms the new Thursday slot."}
                  ],
                  "tool_mocks": {
                    "strategy": "all",
                    "tools": [
                      {
                        "tool": {"id": "<tool-id>", "name": "Book appointment", "type": "webhook"},
                        "result": {"status": "confirmed"}
                      }
                    ]
                  }
                }
              }'
components:
  schemas:
    PublicAgentTestCreatePayload:
      additionalProperties: false
      properties:
        name:
          maxLength: 200
          minLength: 1
          title: Name
          type: string
        test_type:
          default: next_reply
          enum:
            - next_reply
            - tool
            - simulation
          title: Test Type
          type: string
        folder_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            The test folder to put the test in (`/v1/agent/test-folders`). null,
            an empty value and `root` all mean outside any folder. An id that is
            not a folder of the workspace the test is created in is ignored, and
            the test is created outside any folder.
          title: Folder Id
        conversation:
          items:
            $ref: '#/components/schemas/AgentTestMessagePayload'
          title: Conversation
          type: array
        expectation:
          default: ''
          maxLength: 400
          title: Expectation
          type: string
        success_examples:
          items:
            type: string
          title: Success Examples
          type: array
        failure_examples:
          items:
            type: string
          title: Failure Examples
          type: array
        referenced_tool:
          anyOf:
            - $ref: '#/components/schemas/AgentTestReferencedTool'
            - type: 'null'
          default: null
        tool_parameters:
          items:
            $ref: '#/components/schemas/AgentTestToolParameter'
          title: Tool Parameters
          type: array
        verify_absence:
          default: false
          title: Verify Absence
          type: boolean
        simulation:
          anyOf:
            - $ref: '#/components/schemas/AgentTestSimulationConfig'
            - type: 'null'
          default: null
        channel:
          anyOf:
            - enum:
                - web_voice
                - phone_inbound
                - phone_outbound
              type: string
            - type: 'null'
          default: null
          description: >-
            The channel a `next_reply` or `tool` test plays, `web_voice` when
            left out. The agent speaks and has the tools as on that channel:
            client tools on `web_voice` only, `_transfer_call` on the two phone
            channels, `_press_keys` and `_skip_turn` on `phone_outbound`. A
            `tool` test cannot reference a tool its channel lacks. A
            `simulation` test has its own in `simulation.channel`.
          title: Channel
        dynamic_variables:
          additionalProperties:
            anyOf:
              - type: string
              - type: integer
              - type: number
              - type: boolean
          title: Dynamic Variables
          type: object
        judge:
          anyOf:
            - $ref: '#/components/schemas/AgentTestJudge'
            - type: 'null'
          default: null
          description: >-
            The judge of a `next_reply` or `simulation` test. Null follows the
            workspace's Tests settings (`GET /v1/agent/test-settings`). A `tool`
            test has no judge, it is null there.
        agent_ids:
          description: >-
            Agents to attach the test to. They must all be in one workspace, and
            the test is created there. Without agents the test goes into the API
            key owner's default workspace.
          items:
            type: string
          maxItems: 100
          title: Agent Ids
          type: array
      required:
        - name
      title: PublicAgentTestCreatePayload
      type: object
    PublicAgentTestMessage:
      properties:
        role:
          enum:
            - agent
            - user
          title: Role
          type: string
        text:
          title: Text
          type: string
      required:
        - role
        - text
      title: PublicAgentTestMessage
      type: object
    AgentTestReferencedTool:
      additionalProperties: false
      description: |-
        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"), a system tool by its tool name (for
        example "_end_call"). `name` may be left out for a system tool.
      properties:
        id:
          maxLength: 64
          minLength: 1
          title: Id
          type: string
        name:
          maxLength: 200
          minLength: 1
          title: Name
          type: string
        type:
          default: webhook
          enum:
            - webhook
            - client
            - integration
            - system
          title: Type
          type: string
        description:
          default: ''
          maxLength: 2000
          title: Description
          type: string
      required:
        - id
        - name
      title: AgentTestReferencedTool
      type: object
    AgentTestToolParameter:
      additionalProperties: false
      properties:
        name:
          maxLength: 100
          minLength: 1
          title: Name
          type: string
        value:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: boolean
          title: Value
        type:
          anyOf:
            - enum:
                - string
                - number
                - boolean
              type: string
            - type: 'null'
          default: null
          title: Type
      required:
        - name
        - value
      title: AgentTestToolParameter
      type: object
    AgentTestSimulationConfig:
      additionalProperties: false
      properties:
        scenario:
          maxLength: 10000
          minLength: 1
          title: Scenario
          type: string
        max_turns:
          default: 10
          maximum: 50
          minimum: 1
          title: Max Turns
          type: integer
        success_conditions:
          items:
            $ref: '#/components/schemas/AgentTestSuccessCondition'
          maxItems: 10
          minItems: 1
          title: Success Conditions
          type: array
        assertions:
          $ref: '#/components/schemas/AgentTestSimulationAssertions'
        tool_mocks:
          $ref: '#/components/schemas/AgentTestToolMocks'
        simulated_user_model:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Simulated User Model
        repeat_count:
          default: 1
          maximum: 20
          minimum: 1
          title: Repeat Count
          type: integer
        channel:
          anyOf:
            - enum:
                - web_voice
                - phone_inbound
                - phone_outbound
              type: string
            - type: 'null'
          default: null
          title: Channel
        context:
          $ref: '#/components/schemas/AgentTestSimulationContext'
      required:
        - scenario
        - success_conditions
      title: AgentTestSimulationConfig
      type: object
    AgentTestJudge:
      additionalProperties: false
      description: |-
        The model that judges a `next_reply` or `simulation` test, and how much
        it reasons before its verdict.
      properties:
        model:
          description: >-
            One of the models `GET /v1/agent/llm-models` lists with
            `test_judge`.
          maxLength: 200
          minLength: 1
          title: Model
          type: string
        reasoning_level:
          anyOf:
            - enum:
                - 'off'
                - low
                - medium
                - high
                - very_high
              type: string
            - type: 'null'
          default: null
          description: >-
            One of the levels `test_judge.reasoning_levels` lists for the model.
            Null reasons at the model's default level.
          title: Reasoning Level
      required:
        - model
      title: AgentTestJudge
      type: object
    AgentTestMessagePayload:
      properties:
        role:
          enum:
            - agent
            - user
          title: Role
          type: string
        text:
          maxLength: 2000
          minLength: 1
          title: Text
          type: string
      required:
        - role
        - text
      title: AgentTestMessagePayload
      type: object
    AgentTestSuccessCondition:
      additionalProperties: false
      description: >-
        One natural-language criterion the judge scores on the whole
        conversation.
      properties:
        name:
          maxLength: 80
          minLength: 1
          title: Name
          type: string
        description:
          maxLength: 500
          minLength: 1
          title: Description
          type: string
      required:
        - name
        - description
      title: AgentTestSuccessCondition
      type: object
    AgentTestSimulationAssertions:
      additionalProperties: false
      description: Deterministic checks run before the judge, no LLM involved.
      properties:
        tool_calls:
          items:
            $ref: '#/components/schemas/AgentTestToolCallAssertion'
          maxItems: 100
          title: Tool Calls
          type: array
        forbidden_tools:
          items:
            $ref: '#/components/schemas/AgentTestReferencedTool'
          maxItems: 100
          title: Forbidden Tools
          type: array
        ended_by:
          anyOf:
            - enum:
                - agent
                - user
                - transfer
                - any
              type: string
            - type: 'null'
          default: null
          title: Ended By
      title: AgentTestSimulationAssertions
      type: object
    AgentTestToolMocks:
      additionalProperties: false
      description: |-
        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.
      properties:
        strategy:
          default: all
          enum:
            - all
            - selected
            - none
          title: Strategy
          type: string
        fallback:
          default: error
          enum:
            - error
            - real
          title: Fallback
          type: string
        tools:
          items:
            $ref: '#/components/schemas/AgentTestToolMock'
          maxItems: 50
          title: Tools
          type: array
        real_tools:
          items:
            $ref: '#/components/schemas/AgentTestReferencedTool'
          maxItems: 50
          title: Real Tools
          type: array
      title: AgentTestToolMocks
      type: object
    AgentTestSimulationContext:
      additionalProperties: false
      description: |-
        The run's platform context switches, the agent config's `context`
        section for a test. Off so a date pinned in the prompt holds.
      properties:
        current_time:
          default: false
          title: Current Time
          type: boolean
      title: AgentTestSimulationContext
      type: object
    AgentTestToolCallAssertion:
      additionalProperties: false
      description: |-
        The agent must have called this tool, optionally with matching
        arguments, between min_calls and max_calls times (calls that match).
      properties:
        tool:
          $ref: '#/components/schemas/AgentTestReferencedTool'
        params:
          additionalProperties:
            $ref: '#/components/schemas/AgentTestParamMatcher'
          title: Params
          type: object
        min_calls:
          default: 1
          maximum: 100
          minimum: 0
          title: Min Calls
          type: integer
        max_calls:
          anyOf:
            - maximum: 100
              minimum: 0
              type: integer
            - type: 'null'
          default: null
          title: Max Calls
      required:
        - tool
      title: AgentTestToolCallAssertion
      type: object
    AgentTestToolMock:
      additionalProperties: false
      description: |-
        A canned result for one library or integration tool, optionally gated
        on the call arguments. A system tool takes no mock.
      properties:
        tool:
          $ref: '#/components/schemas/AgentTestReferencedTool'
        result:
          $ref: '#/components/schemas/JsonValue'
          default: null
        status:
          anyOf:
            - maximum: 599
              minimum: 100
              type: integer
            - type: 'null'
          default: null
          title: Status
        when:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/AgentTestParamMatcher'
              type: object
            - type: 'null'
          default: null
          title: When
        error:
          default: false
          title: Error
          type: boolean
      required:
        - tool
      title: AgentTestToolMock
      type: object
    AgentTestParamMatcher:
      additionalProperties: false
      description: |-
        How one tool argument is compared: exact string equality, a regular
        expression searched in the value, or mere presence. Regexes are
        JavaScript without flags, mock conditions run in the runtime as written
        and assertions are translated to Python for scoring.
      properties:
        type:
          default: exact
          enum:
            - exact
            - regex
            - any
          title: Type
          type: string
        value:
          anyOf:
            - maxLength: 1000
              type: string
            - type: 'null'
          default: null
          title: Value
      title: AgentTestParamMatcher
      type: object
    JsonValue: {}
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

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