Skip to main content

Agent Studio test cases are simulated conversations that run your agent end-to-end in the sandbox environment. They are managed locally as YAML files under test_suite/ and pushed to Agent Studio with poly push.

Each test case describes a scenario for a simulated user and a set of assertions to evaluate against the resulting conversation. Then, the tests run inside Agent Studio against the pushed branch.

Where tests fit in the workflow

Tests sit between validation and merge in the standard CLI working pattern. Edit locally, validate with poly validate, push, then trigger and inspect the test suite with poly test.

Validation

Use poly validate to check project configuration before pushing.

Simulated conversations

Define test cases under test_suite/ and run them with poly test run.

Interactive review

Use poly chat, poly test show, and Agent Studio to spot-check behavior on the pushed branch.

Location

Test cases are defined as one YAML file per test under:
The directory is optional. Create it only when you have test cases to define.
Filename must match the test nameThe filename (without .yaml) must match the normalized form of the name field: lowercased, with punctuation replaced by underscores. Greeting flow test becomes greeting_flow_test.yaml. poly push rejects mismatched names.

What a test case contains

At least one of prompt_assertions or function_call_assertions should be set — a test with no assertions runs but cannot pass or fail.

Prompt assertions

Each prompt assertion is a free-text statement evaluated against the full conversation by an LLM judge. Write them as observable behaviors, not internal reasoning.

Function call assertions

Each function call assertion checks that a global function was called and, optionally, with specific argument values. Argument assertion fields:
Only function name and argument values are asserted. The function does not have to be the only call in the conversation, and the order of calls is not checked.

Example

A minimal webchat smoke test with only a prompt assertion:

Validation

poly validate checks each test case:
  • channel must be voice or webchat
  • scenario is required and non-empty
  • language is required and must be one of the project’s configured languages (default_language or additional_languages)
  • variant, if set, must reference a variant declared in config/variant_attributes.yaml
  • each function_call_assertions[*].name must match a global function under functions/
  • each argument’s value_type must be one of string, integer, number, boolean
  • the filename must match the normalized name
Validation runs automatically as part of poly push.

Push and run

Test cases follow the standard ADK lifecycle:
  1. edit YAML files under test_suite/ locally
  2. validate with poly validate
  3. push with poly push to sync to Agent Studio
  4. trigger and monitor the suite with poly test run
poly push creates, updates, or deletes test cases on Agent Studio to match local state, including prompt_assertions and tags. Use poly test run to trigger execution and poly test show / poly test list to inspect results — all without leaving the terminal.
Tests are branch-scopedTests are pushed to the current branch and run against that branch’s agent. Use a branch per scenario when iterating on flows or topics so test results map cleanly to the change under review.

Running tests from the CLI

The poly test command group covers the full testing lifecycle.

poly test run

Trigger a test run against the current branch. Runs all tests by default.
After triggering, the CLI polls for results every 5 seconds and displays a live-updating table. For projects with 20 or fewer tests the full table is shown; for larger suites a compact rolling view is used instead. Both views update in place until the run completes. When --dont-poll is used, the CLI prints the run ID and a poly test show command to retrieve results:

poly test list

List past test runs for the current project and branch.
The table shows run ID, start time, status, total/passed/failed/error counts, and who triggered the run.

poly test show

Inspect a completed test run or drill into a single test case.
poly test show <run_id> prints a summary of the run (status, counts, timestamps) followed by a table of all individual test results. poly test show <run_id> <test_case_id> drills into a single test — showing assertion results, any function call failures, and the full conversation transcript turn-by-turn.

Test run statuses

The CLI handles the full set of Agent Studio test run and test case statuses: After a run completes, poly test run prints a summary of failures (assertion reasons, function call failures, and conversation IDs) and exits with a non-zero status code when any test failed or errored.

JSON output

All poly test subcommands support --json for machine-readable output.

What to cover

Good coverage of a project usually includes:
  • the happy path of every flow and major topic
  • key error paths — missing booking, invalid input, unavailable slot
  • function call shape — confirm the agent calls the right function with the right arguments for each branch of logic
  • state transitions across turns — confirm later turns reference earlier user input
  • behavior on the channels your project actually ships on (voice, webchat, or both)

Best practices

  • write scenario as a short, concrete user goal — “Ask to cancel a booking with reference ABC123” — not a script
  • prefer prompt assertions for behavior, function call assertions for integration correctness
  • keep each test case focused on one outcome; split combined scenarios into multiple files
  • use tags consistently (smoke, regression, <flow_name>) so suites can be filtered with --tag
  • cover error paths, not only success cases
  • add a webchat and a voice variant of any critical path that runs on both channels
  • validate as part of the normal edit loop, not just before merge
  • combine the suite with poly chat and interactive review in Agent Studio when behavior depends on the full conversation flow

CLI reference

poly validate, poly push, poly chat, and poly test — the commands used in the test workflow.

Functions

Reference for the global functions named in function call assertions.

Variants

Define the variants referenced by the variant field.

Languages

Configure the languages a test case can target.

Working locally

How tests fit into the daily edit / validate / push loop.
Last modified on July 9, 2026