File run as scenario
Turn an eval run into a repeatable scenario and save it to the Scenarios library. Given a runId (from get_test_results), this reads what actually happened on that run, the conversation and the tool calls the agent made, and drafts ONE 'instruction' scenario: the caller's opening line, a first-person behaviour brief, and an expected-outcome prompt the judge reads. Use it when a run surprises you and the behaviour deserves a permanent test: a red you want to keep checking, or a green that only passed by luck. Works for voice and text runs alike. The scenario is a TEST HARNESS only, it never changes how the agent behaves. The run must have at least one caller turn.
Authorization
bearerAuth A personal access token from Settings > API tokens.
In: header
Header Parameters
A key you choose, such as a UUID, that makes this POST safe to retry. Within 24 hours the same key and request answers with the first successful answer and runs nothing, the same key with a different request answers 422 idempotency_key_reused, and a key whose request is still running answers 409 idempotency_key_in_use. A failed request keeps nothing, so the same key runs it again.
1 <= length <= 255Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
curl -X POST "https://example.com/operations/create_scenario_from_run" \ -H "Content-Type: application/json" \ -d '{ "runId": "string", "agent": "string" }'{}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"code": "string",
"errors": [
{
"path": "string",
"message": "string"
}
],
"estimate": {},
"retryAfterSeconds": 0
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"code": "string",
"errors": [
{
"path": "string",
"message": "string"
}
],
"estimate": {},
"retryAfterSeconds": 0
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"code": "string",
"errors": [
{
"path": "string",
"message": "string"
}
],
"estimate": {},
"retryAfterSeconds": 0
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"code": "string",
"errors": [
{
"path": "string",
"message": "string"
}
],
"estimate": {},
"retryAfterSeconds": 0
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"code": "string",
"errors": [
{
"path": "string",
"message": "string"
}
],
"estimate": {},
"retryAfterSeconds": 0
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"code": "string",
"errors": [
{
"path": "string",
"message": "string"
}
],
"estimate": {},
"retryAfterSeconds": 0
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"code": "string",
"errors": [
{
"path": "string",
"message": "string"
}
],
"estimate": {},
"retryAfterSeconds": 0
}Create publishable key POST
Mint a publishable key (pk_live_/pk_test_) authorising the embeddable website widget to talk to this agent. A key answers only WHICH SITES may connect (its origin allowlist); which surfaces exist is the agent's own answer (set_channel). The raw key is returned exactly once, store it immediately; only its hash is kept. Publishable keys are public by design (they ship in a website's HTML), scoped to this one agent, and constrained by their origin allowlist, so set allowedOrigins to the sites that will embed the widget.
Create scenario from call POST
Derive a complete test-harness scenario from a real call and save it to the Scenarios library. Given a sessionId (from list_calls), this reads the call's full transcript, including the tool calls the agent made, and drafts ONE 'instruction' scenario: the caller's opening line, a first-person behaviour brief replaying the caller's side of the call, and an expected-outcome prompt derived from what actually happened (the judge reads it). Observed tool calls are noted as context in the brief, never invented as mock data. Use it to turn a notable real call (a bug report, a tricky caller, a regression) into a repeatable test. The scenario is a TEST HARNESS only, it never changes how the agent itself behaves. The call must have at least one caller turn.