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.
Where tests fit in the workflow
Tests sit between validation and merge in the standard CLI working pattern. Edit locally, validate withpoly 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: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.
Test clock
simulated_at pins the agent’s notion of “now” for the duration of the simulated conversation. Use it to make time-dependent behavior deterministic — out-of-hours routing, “tomorrow” date resolution, or a seasonal greeting — instead of depending on when the suite happens to run.
poly pull, so 2026-01-15T22:30:00+00:00 and 2026-01-15T23:30:00+01:00 both round-trip as 2026-01-15T22:30:00Z. An offset-less value such as 2026-01-15T22:30:00 is treated as UTC. Omit the field to run against the real clock; removing it from a file that had one clears the test clock on the next push.
Mock call context
A real conversation arrives carrying more than the caller’s words: the number it came from, the SIP headers a carrier attached, the attributes a channel passed in. Three optional fields simulate that, so a flow that branches on any of it can be tested without placing a real call.caller_number
The number the call arrives from, always text. The agent reads it asconv.caller_number.
Leave it out to simulate a withheld or anonymous number — a real production case worth testing, so no format validation is applied beyond trimming whitespace.
Quote it. YAML reads an unquoted number as an integer and drops a leading +:
poly push rejects an unquoted number rather than converting it, because the two cases are indistinguishable once YAML has parsed them and silently sending a different number would make the test lie.
sip_headers
Headers a carrier would send with an inbound call. The agent reads them asconv.sip_headers.
Header names are case-sensitive — match exactly what your telephony integration sends. Values are always text on the wire, so a YAML true is sent as "true" and a number as its digits. Quote anything you want preserved exactly.
Headers can be set on a webchat test, but a real webchat conversation never receives them, so the test would cover a state production cannot reach.
integration_attributes
Attributes a channel or connector passes in. The agent reads them asconv.integration_attributes.
Unlike SIP headers, these keep their type, so a flow branching on retry_count > 2 sees a number rather than the text "2". Text, numbers, true/false, null, lists, and nested maps are all supported.
Types come from YAML, which means quoting matters:
Dates must be quoted. An unquoted
expiry: 2026-08-12 is a YAML date, which the agent cannot receive, and poly push rejects it rather than guessing what you meant.
Mock agent memory
agent_memory sets the Agent Memory profile the agent sees, read as conv.memory, so returning-caller and first-time-caller paths each get a test case of their own. When it is set, it replaces conv.memory for the whole run, and nothing stored for the caller is read.
A flow that branches on
conv.memory wants both a returning-caller case and a first-time-caller case. caller_number alone doesn’t make a returning caller, so use agent_memory for that.
Values follow the same type rules as integration_attributes: they keep their YAML type, nested maps and lists are supported, and dates must be quoted. Use synthetic values only, never real customer data.
Pulling, renaming and pushing a case keep {} and an absent field distinct.
API mocks
A flow that branches on an API integration’s response — a booking that’s available vs. full, a lookup that succeeds vs. errors — needs that response to be deterministic to test reliably.api_mocks intercepts calls to a named integration operation during simulation and returns the mocked response instead of calling the real API.
Mocks are keyed by integration name, then operation name, then a list of response rules tried in order:
Once a list’s rules are exhausted (no trailing
-1 rule), further calls to that operation fall through to the real API.
Operation names aren’t cross-checked at push timeThe integration name must match an existing
api_integration resource; poly push rejects an unknown one. Operation names are not validated against the integration’s configured operations — instead, renaming or deleting the underlying operation automatically cascades to any mocks that reference it, the same way the platform handles the rest of the integration/operations relationship.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 function was called and, optionally, with specific argument values.
Argument assertion fields:
Example
Validation
poly validate checks each test case:
channelmust bevoiceorwebchatscenariois required and non-emptytagsmust be uniquelanguageis required and must be one of the project’s configured languages (default_languageoradditional_languages)variant, if set, must reference a variant declared inconfig/variant_attributes.yamlsimulated_at, if set, must be a valid ISO 8601 datetimecaller_number, if set, must be text — an unquoted number is rejected rather than convertedintegration_attributesvalues must be text, numbers,true/false,null, lists, or nested maps; an unquoted date is rejected with the quoted form to use instead; keys must be textagent_memory, if set, must be a map; its values follow the same type rules asintegration_attributesapi_mocks: the integration name must match an existingapi_integrationresource; each operation must have at least one response rule; each rule’srespond.statusmust be a valid HTTP status code (100–599);respond.body, if set, follows the same type rules asintegration_attributes;repeat, if set, must be a positive integer or-1(respond forever), and-1is only allowed on the last rule for an operation- each
function_call_assertions[*].namemust match a global function underfunctions/or a flow function underflows/<flow>/functions/ - each argument’s
value_typemust be one ofstring,integer,float,boolean - each argument’s
expected_value, when set, must not be blank and must read as itsvalue_type - the filename must match the normalized
name
poly push.
Push and run
Test cases follow the standard ADK lifecycle:- edit YAML files under
test_suite/locally - validate with
poly validate - push with
poly pushto sync to Agent Studio - 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. See poly test for the commands and their flags.
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
scenarioas 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
tagsconsistently (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 chatand interactive review in Agent Studio when behavior depends on the full conversation flow
Related pages
CLI reference
poly validate, poly push, poly chat, and poly test — the commands used in the test workflow.Functions
Reference for the functions named in function call assertions.
API integrations
Define the integrations and operations that
api_mocks intercepts.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.

