agents

Create an agent

Changed on

Creates an agent: a task for a phone, as instructions an agent works through a model or as code, with the model, output schema and limits its runs use. Sending instructions or code creates the agent's first revision with it; sending source_run_id saves one of your agent runs as the agent, its task or its script as the first revision. A name already used in the organization is 409; an unsupported model, an invalid output schema, both instructions and code, or a run with no task or script to save is 400; another organization's run is 404.

post/agents

Request

Request body

$schemastring uri

A URL to the JSON Schema for this object.

accessibility_enabledboolean

Use accessibility mode for runs (default false). Needs your organization's access to accessibility mode: without it the create is refused with a 403 whose message starts with accessibility_unavailable.

capture_enabledboolean

Capture the media runs produce into the file library (default true).

codestring

Python the agent runs. Creates a code revision. Leave out to add a revision later, or send instructions instead.

from'task' | 'script'

With source_run_id, what the first revision is. task (default): the run's task, as an instructions revision. script: the script the run left (GET /runs/{run_id}/script), as a code revision. A run with no task, or no script, is 400.

instructionsstring

The task for the agent to work through a model. Creates an instructions revision. Leave out to add a revision later, or send code instead.

max_cost_microdollarsinteger

Most a run's model steps may cost, in microdollars (default 10000000).

max_stepsinteger

Most model steps a run may take (default 500).

modelstring

The model instruction runs call, one of GET /models. Defaults to the platform default.

namestring required

The agent's name: letters, numbers, hyphens and underscores, unique within the organization.

on_failure'fail' | 'ask' | 'repair'

With code: what a run does when a step fails. fail (default) fails the run. ask pauses the run for a person (reason step_check_failed), who retries the step or completes the run with its output. repair hands the run to the agent, which finishes the task from the live screen and proposes a fixed revision for a person to promote.

output_schemaobject

The JSON Schema a run's result must satisfy. Leave out to take any result.

pause_timeout_secondsinteger

Longest a run waits paused for an answer, in seconds (default 600, 60 to 3600).

recording_enabledboolean

Record the screen of runs (default false).

source_run_idstring uuid

Save one of your agent runs as the agent: its first revision comes from the run (see from), and the run's model, output schema and limits stand in for any left out here. Send it without instructions or code. Another organization's run is 404.

telemetry_enabledboolean

Emit telemetry for runs (default true).

timeout_secondsinteger

Longest a run may take, in seconds (default 3600, at most 3600).

Example request

{
  "$schema": "/api/v1/AgentCreateRequest.json"
}

Response

Created

$schemastring uri

A URL to the JSON Schema for this object.

accessibility_enabledboolean required

Runs use accessibility mode, which needs a phone that supports it.

capture_enabledboolean required

Runs capture the media they produce on the phone into the file library.

created_atstring date-time required

When the agent was created.

current_revision_idstring uuid

The revision runs of the agent use. Absent until the agent has one.

idstring uuid required

The agent's id.

last_run_atstring date-time

When a run of the agent last started.

max_cost_microdollarsinteger required

Most a run's model steps may cost, in microdollars.

max_stepsinteger required

Most model steps a run may take.

modelstring required

The model an instructions revision's runs call, one of GET /models.

namestring required

The agent's name, unique within the organization.

output_schemaobject

The JSON Schema a run's result must satisfy. Absent takes any result.

pause_timeout_secondsinteger required

Longest a run waits paused for an answer, in seconds, before it fails with input_timeout. A pause also ends with the session.

recording_enabledboolean required

Runs record the screen.

telemetry_enabledboolean required

Runs emit telemetry, live and stored.

timeout_secondsinteger required

Longest a run may take, in seconds, within the one-hour session cap.

updated_atstring date-time required

When the agent was last changed.

Example response

{
  "$schema": "/api/v1/Agent.json"
}

Changes