vialUnit Tests

Combine a persona, scenario, service, and success criteria into a single repeatable test case.

Manage individual simulation test cases. A unit test combines a persona, a scenario, a target service (with version set), and success criteria to form a single, repeatable test of agent behavior.

circle-info

Composition

A unit test references:

  • A persona (simulated user profile)

  • A scenario (conversation objectives and instructions)

  • A service and version set (the agent configuration to test)

  • One or more success criteria (metrics with pass/fail thresholds)

The persona and scenario are referenced by ID; their latest versions are used at run time.

Create a Unit Test

Create a new simulation unit test.

curl --request POST \
     --url 'https://api.amigo.ai/v1/<YOUR-ORG-ID>/simulation/unit_test/' \
     --header 'Authorization: Bearer <AUTH-TOKEN>' \
     --header 'Content-Type: application/json' \
     --data '{
       "name": "Onboarding - Confused New User",
       "description": "Tests that the agent successfully guides a confused new user through account setup.",
       "service_id": "6618791275130b73714e8d1c",
       "service_version_set_name": "release",
       "persona_id": "6618791275130b73714e8d2a",
       "scenario_id": "6618791275130b73714e8d3b",
       "max_interactions": 20,
       "success_criterions": [
         {
           "name": "Completion Rate",
           "metric_id": "6618791275130b73714e8d4c",
           "criterion": {
             "type": "boolean",
             "expected_value": true
           }
         }
       ],
       "tags": {"suite": "onboarding", "priority": "high"}
     }'

Response (201):

Success Criteria

Each success criterion links a metric to a pass/fail threshold. The criterion object defines the expected outcome based on the metric type (boolean, numeric, etc.). The metric_id must reference an existing conversation metric, and the criterion type must match the metric type.

Create a simulation unit test

post
/v1/{organization}/simulation/unit_test/

Create a new simulation unit test.

Permissions

This endpoint requires the following permissions:

  • Simulation:CreateSimulationUnitTest for the unit test to create.
Authorizations
AuthorizationstringRequired

The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.

AuthorizationstringRequired

Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.

X-ORG-IDstringRequired

An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.

Path parameters
organizationstringRequired
Header parameters
x-mongo-cluster-nameany ofOptional

The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.

stringOptional
or
nullOptional
Sec-WebSocket-Protocolstring[]OptionalDefault: []
Body
namestring · min: 1Required

The name of the unit test.

descriptionstring · min: 1Required

A description of the unit test.

service_idstringRequired

The service that the unit test runs on.

Pattern: ^[a-f0-9]{24}$
service_version_set_namestringRequired

The version set of the service that the unit test runs on.

persona_idstringRequired

The persona that unit test uses.

Pattern: ^[a-f0-9]{24}$
scenario_idstringRequired

The scenario that the unit test uses.

Pattern: ^[a-f0-9]{24}$
max_interactionsinteger · max: 100Required

The max number of interactions after which the unit test fails.

Responses
post
/v1/{organization}/simulation/unit_test/

List Unit Tests

Retrieve simulation unit tests that match the given filters. Only unit tests the authenticated user has Simulation:GetSimulationUnitTest permission for are returned.

Common filters:

  • id=<id> (repeatable) -- filter by specific unit test IDs

  • is_deleted=true|false -- filter by deletion status

  • service_id=<id> (repeatable) -- filter by service

  • persona_id=<id> (repeatable) -- filter by persona

  • scenario_id=<id> (repeatable) -- filter by scenario

  • creator=<org_id,user_id> (repeatable) -- filter by creator

  • tag=key:value (repeatable; value may be * for any value, or empty for null)

  • sort_by=+created_at|-created_at|+name|-name (repeatable)

  • limit (0--500, default 50), continuation_token (int, default 0)

Get simulation unit tests

get
/v1/{organization}/simulation/unit_test/

Retrieve the simulation unit tests that match the given filters.

Permissions

This endpoint may be impacted by the following permissions:

  • Only simulation unit tests that the authenticated user has Simulation:GetSimulationUnitTest permission for will be retrieved.
Authorizations
AuthorizationstringRequired

The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.

AuthorizationstringRequired

Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.

X-ORG-IDstringRequired

An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.

Path parameters
organizationstringRequired
Query parameters
idstring[]Optional

The IDs of the simulation unit tests to retrieve.

Default: []
limitinteger · max: 500Optional

The maximum number of simulation unit tests to return.

Default: 50
continuation_tokenintegerOptional

The continuation token from the previous request used to retrieve the next page of simulation unit tests.

Default: 0
is_deletedany ofOptional

Whether the simulation unit test is deleted.

booleanOptional
or
nullOptional
service_idstring[]Optional

The IDs of the services that the simulation unit tests run on.

Default: []
persona_idstring[]Optional

The IDs of the personas that the simulation unit tests use.

Default: []
scenario_idstring[]Optional

The IDs of the scenarios that the simulation unit tests use.

Default: []
metric_idstring[]Optional

The IDs of the metrics that the simulation unit tests use.

Default: []
creatorstring[]Optional

The creators of the simulation unit tests. Each value must be of the format org_id,user_id.

Default: []
tagstring[]Optional

The tags of the simulation unit tests. Must be specified using the syntax key:value, which means to match all sets with the given key and value pair among its tags. If value is *, it means the value does not matter. If value is empty, it matches against when the value is None.

Default: []
sort_bystring[]Optional

The fields to sort the sets by. Supported fields are updated_at. Specify a + before the field name to indicate ascending sorting and - for descending sorting. Multiple fields can be specified to break ties.

Default: []
Header parameters
x-mongo-cluster-nameany ofOptional

The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.

stringOptional
or
nullOptional
Sec-WebSocket-Protocolstring[]OptionalDefault: []
Responses
chevron-right
200

Succeeded.

application/json
has_morebooleanRequired

Whether there are more simulation unit tests to retrieve.

continuation_tokenany ofRequired

The continuation token to use to retrieve the next page of simulation unit tests.

integerOptional
or
nullOptional
filter_valuesany ofRequired

For each filter that this endpoint supports that can take on dynamic values, this field includes what these values are. This is only provided for the first page in the pagination results.

Note that the values are counted assuming the authenticated user has access to all the simulation unit tests, so they might differ from how many sets are actually retrieved.

or
nullOptional
get
/v1/{organization}/simulation/unit_test/

Search Unit Tests

Search for simulation unit tests by text query. Matches against the unit test name and description. Returns the top 50 results sorted by relevance.

  • query (required) -- the search text

  • creator=<org_id,user_id> (repeatable) -- filter by creator

  • tag=key:value (repeatable)

get
/v1/{organization}/simulation/unit_test/search/

Search for simulation unit tests that match the given filters and whose name or description contains the specified query.

Permissions

This endpoint may be impacted by the following permissions:

  • Only simulation unit tests that the authenticated user has Simulation:GetSimulationUnitTest permission for will be retrieved.
Authorizations
AuthorizationstringRequired

The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.

AuthorizationstringRequired

Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.

X-ORG-IDstringRequired

An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.

Path parameters
organizationstringRequired
Query parameters
querystring · min: 1Required

The query to search for. Any simulation unit tests containing the terms in its name would be returned.

creatorstring[]Optional

The creators of the simulation unit tests. Each value must be of the format org_id,user_id.

Default: []
tagstring[]Optional

The tags of the simulation unit tests. Must be specified using the syntax key:value, which means to match all sets with the given key and value pair among its tags. If value is *, it means the value does not matter. If value is empty, it matches against when the value is None.

Default: []
service_idstring[]Optional

The IDs of the services that the simulation unit tests run on.

Default: []
persona_idstring[]Optional

The IDs of the personas that the simulation unit tests use.

Default: []
scenario_idstring[]Optional

The IDs of the scenarios that the simulation unit tests use.

Default: []
metric_idstring[]Optional

The IDs of the metrics that the simulation unit tests use.

Default: []
Header parameters
x-mongo-cluster-nameany ofOptional

The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.

stringOptional
or
nullOptional
Sec-WebSocket-Protocolstring[]OptionalDefault: []
Responses
chevron-right
200

Succeeded.

application/json
get
/v1/{organization}/simulation/unit_test/search/

Update a Unit Test

Modify an existing simulation unit test. All fields are optional -- only the fields you include will be updated.

Update a simulation unit test

post
/v1/{organization}/simulation/unit_test/{simulation_unit_test_id}/

Modify the specified simulation unit test.

Permissions

  • Simulation:ModifySimulationUnitTest for the unit test to update.
Authorizations
AuthorizationstringRequired

The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.

AuthorizationstringRequired

Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.

X-ORG-IDstringRequired

An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.

Path parameters
organizationstringRequired
simulation_unit_test_idstringRequired

The ID of the simulation unit test to update.

Pattern: ^[a-f0-9]{24}$
Header parameters
x-mongo-cluster-nameany ofOptional

The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.

stringOptional
or
nullOptional
Sec-WebSocket-Protocolstring[]OptionalDefault: []
Body
descriptionany ofOptional

A description of the unit test.

string · min: 1Optional
or
nullOptional
service_idany ofOptional

The service that the unit test runs on.

stringOptionalPattern: ^[a-f0-9]{24}$
or
nullOptional
service_version_set_nameany ofOptional

The version set of the service that the unit test runs on.

stringOptional
or
nullOptional
persona_idany ofOptional

The persona that unit test uses.

stringOptionalPattern: ^[a-f0-9]{24}$
or
nullOptional
scenario_idany ofOptional

The scenario that the unit test uses.

stringOptionalPattern: ^[a-f0-9]{24}$
or
nullOptional
max_interactionsany ofOptional

The max number of interactions after which the unit test fails.

integer · max: 100Optional
or
nullOptional
success_criterionsany ofOptional

The success criterions for the unit test.

or
nullOptional
run_countany ofOptional

Each time this unit test is run, the number of sessions to simulate.

integerOptional
or
nullOptional
tagsany ofOptional

The tags of the simulation persona.

or
nullOptional
Responses
post
/v1/{organization}/simulation/unit_test/{simulation_unit_test_id}/

No content

Delete a Unit Test

Soft-delete a simulation unit test. Existing references and any scheduled runs remain valid, but no new runs can be created. This endpoint returns an error if the unit test is currently used in any unit test set.

Delete a simulation unit test

delete
/v1/{organization}/simulation/unit_test/{simulation_unit_test_id}/

Delete a simulation unit test. The unit test is soft-deleted and all references to it are still valid. Any scheduled unit test runs would still continue as expected, but no new run can be created.

This endpoint will error if the simulation unit test is used in any simulation unit test set.

Permissions

This endpoint requires the following permissions:

  • Simulation:DeleteSimulationUnitTest for the simulation unit test to delete.
Authorizations
AuthorizationstringRequired

The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.

AuthorizationstringRequired

Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.

X-ORG-IDstringRequired

An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.

Path parameters
organizationstringRequired
simulation_unit_test_idstringRequired

The ID of the simulation unit test to delete.

Pattern: ^[a-f0-9]{24}$
Header parameters
x-mongo-cluster-nameany ofOptional

The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.

stringOptional
or
nullOptional
Sec-WebSocket-Protocolstring[]OptionalDefault: []
Responses
delete
/v1/{organization}/simulation/unit_test/{simulation_unit_test_id}/

No content

Last updated

Was this helpful?