Skip to main content
An agent’s name can contain letters, digits, hyphens and underscores. It must be unique in the organization.

Create an instructions agent

Instructions are a task in plain English. A model works through them on the phone. Add an output_schema when you want a structured result.
The dashboard makes an agent from a run:
  1. Open Agents and click Create agent. This opens Run a task.
  2. Describe the task, for example: “Open Settings, go to About phone, and report the Android version exactly as shown.” Then start the run.
  3. When the run has ended, click Save as agent on the run. See Save a run as an agent.
To set a Result schema, the Model or the limits, open the agent and click Edit.

Create a code agent

A code agent runs a Python script with no model. The script drives phone, reads its inputs from variables and reports its result with run.done. See What a run’s code can use.
search.py
The dashboard makes an agent from a run, so a code agent starts as a saved run or as an existing agent you change:
  • Save a run’s script: on an ended run, click Save as agent and choose to save the script.
  • Change an existing agent to code: open the agent, click Edit and choose Code. Paste the script under Script, choose what happens When a step fails (Fail the run, Ask a person or Repair it), and save.
Send instructions or code, not both. A name already used in the organization returns 409. An unsupported model or an invalid output schema returns 400.

Handle a failed step

A code revision’s on_failure decides what a run does when a step fails, for example when an element can’t be found: A repaired run has repair.repaired: true and, when it proposed a fix, repair.proposed_revision_id. The proposed revision has proposal_state: "waiting" and is not used until a person promotes it. Repair time and model steps count against the run’s limits and are billed like any model step.

Save a run as an agent

Save an ad hoc run as an agent once it has ended. With from: "task" (the default), the run’s task becomes an instructions revision. With from: "script", the code the run executed becomes a code revision. The run’s model, output schema and limits fill in any setting you leave out.
  1. Open the run from Runs.
  2. Click Save as agent. It shows on a run that has ended and wasn’t started from a saved agent.
  3. Enter a name and choose whether to save the task or the script.

Pull and push code

Each push adds a revision, which becomes the one runs use.
  1. Open the agent from Agents and click Edit.
  2. Change the instructions or the script.
  3. Save. The change becomes a new version.
An agent can switch kind: add an instructions revision to a code agent, or the reverse. Revisions are never changed or removed.

Roll back or promote a revision

A rollback copies an earlier revision forward as the newest one, so history only grows. Promoting makes a repair’s proposed fix the current revision.
  1. Open the agent, click Edit, and open Version history.
  2. Select a version to read it.
  3. Click Restore to roll back to it, or Use this fix on a proposed fix.
Promoting returns 409 when the revision is not a fix waiting to be promoted, or when the agent has moved on from the revision the repaired run ran. Such a fix reads proposal_state: "superseded".

Change settings or delete an agent

PATCH /agents/{agent_id} changes the name, model, output schema, limits and data settings. Fields you leave out keep their values, and output_schema: null clears the schema. Instructions and code change only through revisions. Deleting an agent removes it and its revisions, and cancels its schedules’ runs that haven’t started. Its past runs stay in the run list.

Next steps

Run the agent

Start a run now, later, or many at once.

Schedule the agent

Run it on a recurring cron schedule.