Test an agent with a script
Tests the agent without a phone: your customer’s lines are typed to it one at a time in its text test chat, and you get back, per line, what the agent replied, the tools that ran and how long the reply took, then the post-call analysis of the whole conversation on call.
lines is required: 1–30 customer lines, each at most 2000 characters. Optional: variables, call_settings, allowed_tools and metadata as on Place a call, and analysis (default true; false skips the analysis and its wait).
It is a real test call on the text channel, billed by LLM tokens like the console’s chat, and tools run against your real endpoints. One run per agent at a time, at most 3 per workspace.
Authorizations
Body
The voice and languages for this call only, over the agent's. Every key is optional; a key left out keeps the agent's value (or, on a campaign contact, the request's). The same object is accepted on POST /v2/calls, on a campaign contact and in a pre_call tool's result. An unknown key or a value that fails these rules is 400 invalid_request naming it.
Response
The conversation and its analysis
A scripted test's answer (POST /v2/agents/{id}/test_script): the conversation line by line, then the test call as GET /v2/calls/{id} shows it once settled.
completed: every line was sent; ended_early: the agent ended the conversation before the last line (see ended_reason); timed_out: the time budget ran out and the rest were not sent; failed: the conversation could not be continued.
completed, ended_early, timed_out, failed