Runs the saved workflow for one stage with the variables you send and returns each step's result. This is the Save and test button in the Test run box of the workflow editor. Save the stage first with Update agent workflow: the test always runs the saved steps, even when the stage is disabled.
No workflow run is stored and no call is involved, but the steps do run for real: HTTP steps call your URLs, integration_app steps run their action and a send_sms step sends a message when the variables give it an agent number and a recipient.
Request#
Path parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
agent_id |
string | Yes | The agent. |
stage |
string | Yes | pre_call or post_call. |
Body#
| Field | Type | Required | Description |
|---|---|---|---|
variables |
object | No | Sample variables the steps can use, for example to_number or call_summary. Default {}. |
The stage's budget_ms is capped as on a real run. For pre_call, the cap uses variables.direction and treats a missing value as outbound (300000 ms), so send "direction": "inbound" to test with the 60000 ms cap.
Example request#
curl -X POST "https://api.tried.com.au/agents/agent_3f9a1c0b2d4e5f6a7b8c9d0e/workflows/pre_call/test" \
-H "Authorization: Bearer $TRIED_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"variables": { "to_number": "+61412345678", "direction": "outbound" }
}'const res = await fetch("https://api.tried.com.au/agents/agent_3f9a1c0b2d4e5f6a7b8c9d0e/workflows/pre_call/test", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TRIED_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
variables: { to_number: "+61412345678", direction: "outbound" },
}),
});
const result = await res.json();import os, requests
res = requests.post(
"https://api.tried.com.au/agents/agent_3f9a1c0b2d4e5f6a7b8c9d0e/workflows/pre_call/test",
headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
json={
"variables": {"to_number": "+61412345678", "direction": "outbound"},
},
)
result = res.json()Response#
200 OK
{
"status": "success",
"steps": [
{
"id": "lookup",
"name": "CRM lookup",
"status": "success",
"duration_ms": 184,
"outputs": { "customer_name": "Sam Nguyen", "tier": "gold" },
"http_status": 200
}
],
"outputs": { "customer_name": "Sam Nguyen", "tier": "gold" },
"duration_ms": 186
}| Field | Type | Description |
|---|---|---|
status |
string | success (no step errored or timed out), failed (every step errored or timed out), timeout (some, not all, failed and at least one timed out) or partial (some, not all, errored and none timed out). |
steps |
array | One result per step, in dependency order. |
steps[].status |
string | success, skipped, error or timeout. |
steps[].duration_ms |
integer | Time the step took. 0 for skipped steps. |
steps[].outputs |
object | Variables the step set. |
steps[].error |
string | Present when the step did not succeed, for example Condition was false, Dependency lookup did not succeed, Workflow time budget used up or HTTP 500. |
steps[].http_status |
integer | http steps only: the response status. |
outputs |
object | All outputs merged. On a real pre-call run these become dynamic variables. |
duration_ms |
integer | Total run time. |
Errors#
| Status | When |
|---|---|
400 |
Validation failed, for example an unknown stage or variables that is not an object. |
401 |
Missing or invalid API key. |
403 |
The key's IP allowlist or scopes reject the request. This route needs the agents scope. |
404 |
Save the workflow first: the stage was never saved for this agent in this workspace. |
429 |
Rate limit exceeded. See Rate limits. |
See Errors for the body format.