A run is one agent working on one task in its own microVM. You send a prompt, JSON input, and the files and connections it may use. Ephemeral queues it, starts a fresh machine, records every step, and destroys the machine when the run ends.
What a run is made of
Every run has a prompt and optional input. The rest of the definition decides which model it uses, what it can read, what it can call, how long it may take and how much it may spend. You can send the whole definition inline, or name a saved workflow and send only the input.
{
"prompt": "Find out why this payment failed. Follow the playbook.",
"input": { "payment_id": "pay_123" },
"model": "anthropic/claude-haiku-5.5",
"files": [{ "file": "playbook.md" }],
"connections": { "payments": { "ref": "payments-api", "allowed_methods": ["GET"] } },
"timeout_seconds": 120,
"shell": false,
"max_cost_micros": 500000
}Inside the microVM the agent can always read the files you mounted. With shell on, which is the default, it can also run shell commands and write files in its working directory. Each connection you grant adds tools it can call, and with web access on it can read pages, search and call public APIs. The machine itself has no internet. The working directory is discarded with the machine, so nothing carries over to the next run.
The shell has Python 3.14 (python, python3 and pip) and Node.js 22. These Python packages are installed, with their dependencies: numpy, pandas, requests, httpx, beautifulsoup4, lxml, pyyaml, pydantic, openpyxl, python-docx, pypdf, matplotlib, pillow, rich, tabulate and python-dateutil. GET /v1/me lists every installed package with its version (preinstalled_python_packages). Because the machine has no internet, pip install cannot download packages; a wheel you mount as a file installs with pip install --no-index and the path the agent is given for it.
Lifecycle
A run moves through these statuses. The last five are final; once a run reaches one of them it does not change again.
| Status | Meaning |
|---|---|
reserving | Hosted only. Credits for the run's budget are being reserved. |
queued | Waiting for a free worker slot. |
starting | Taken from the queue. The definition and files are being loaded. |
running | The microVM is starting or the agent is working. |
succeeded | The agent finished and returned output. |
failed | The worker failed, or credits could not be reserved. The error field says why: for example the model provider's reason when a model request failed, or that the sandbox could not be started, in which case no run fee is charged and you can retry. |
cancelled | Someone cancelled the run. |
timed_ | The run reached its timeout before finishing. |
interrupted | The engine restarted during the run, or admission did not complete. |
Runs leave the queue oldest first, and organizations take turns: the next run to start comes from the organization with the fewest runs in progress. The hosted service also limits how many runs of one organization are in progress at once. A self-hosted installation runs two at a time by default. The rest wait in queued, and queue_reason says why. The timeout counts from the moment a run leaves the queue, so time spent waiting does not use it up.
Limits
| Limit | Value |
|---|---|
timeout_ | 1 to 3,600. Default 300. |
| Prompt | 128 KiB |
| Input | 1 MiB of JSON |
| Files | 32 per run, 1 MiB each, 4 MiB in total |
| Connections | 16 per run |
| Model calls | 100 per run |
| Output per model reply | The model's own limit, up to 32,000 tokens, shortened to fit what is left of the budget. A reply cut off at the limit is continued automatically, twice at most. |
| Web requests and searches | 50 per run, when web access is on |
| Output | Up to 1 MiB. A longer answer is cut there, and the run records that it was. |
outputs | 20 files per run, 10 MiB each and 25 MiB in all |
| Events | The record keeps up to 256 KiB per event and 10,000 events or 16 MiB per run. Larger tool results are shortened in the record and marked; the agent still receives them in full. When the record is full, later detail is skipped and counted. Neither ever fails the run. |
max_ | 1 to 100,000,000 (up to $100) |
Outputs: files a run saves
A run's result is its text output. To keep files it makes, such as a chart, a spreadsheet or a report, list their paths in outputs. Each path is relative to the agent's working directory, or absolute under /tmp/. When the run ends, Ephemeral saves each file as a file of your organization named runs/<run id>/<path>, up to 20 files, 10 MiB each and 25 MiB per run. The finished run lists them in files (id, name, path, size and content_type).
- A path the agent did not write is reported as an
output_missingevent, and the run does not fail. Saved files appear asoutput_fileevents. - A run without a shell cannot write files itself. The agent is given a
save_outputtool to write them. - Saved files are your storage: they are kept as your retention settings say and billed as storage.
A run can also remember things between runs with state: set state to a store name and the agent gets tools to read and write it.
Progress
On a long task the agent is asked to call its report_progress tool at each milestone, with a short message and how far along it is. The latest report is on the run as progress (message, percent and at) and each one is a progress event, so people following the run can see where it is. A zero-data-retention run does not keep its progress.
Being told when a run ends
Besides a callback, a run can name a saved HTTP connection in notify. When the run has finished and its cost is final, Ephemeral posts JSON to that connection, with the connection's own credentials. You send no URL and no secret with the request, so an agent over MCP can use it too.
{
"workflow": "investigate-payment",
"input": { "payment_id": "pay_123" },
"notify": { "connection": "team-chat", "path": "/hooks/ephemeral", "on": "failure" }
}connectionis the name of a saved HTTP connection that allowsPOST.pathis optional and relative to the connection's URL.onisalways(default) orfailure, to be told only when a run did not succeed.- The body is
{"event": "run.finished", "run": {…}, "text": "one line"}, with the headersX-Ephemeral-Event: run.finishedandX-Ephemeral-Run. - A failed delivery is retried with backoff for a while.
- A batch sends one notification when every run in it has settled, with
eventbatch.finished, the batch summary and its runs. - A run cannot have both
callbackandnotify. Schedules takenotifytoo.
Estimating cost before many runs
Before you start many runs, ask what they are likely to cost. POST /v1/estimates (MCP tool estimate_cost) takes a workflow or a prompt, an optional model and a number of runs, and returns a typical and a high cost per run and in total, with the cap, from your settled runs of the same workflow or prompt with the same model. The typical cost is the median and the high one the 90th percentile. With no history only the cap is known, so start one or a few runs and estimate again. Nothing is started or charged.
Comparing models
In a batch, each input can set its own model, so one batch runs the same task on different models. When the runs use more than one model, the batch summary adds by_model: for each model the runs, how many have finished, their statuses, their cost and whether it is final.
Following a run
There are four ways to learn what a run is doing and when it ends.
- Poll
GET /v1/runs/{id}until the status is final. - Stream
GET /v1/runs/{id}/events. This is a server-sent event stream that replays everything recorded so far, then continues live until the run ends. - Set a callback on the run. Ephemeral sends a signed request to your server when the run reaches a final status.
- Set
notifyto a saved connection, described above, when you would rather not give a URL and a secret.
To read the recorded events as JSON rather than a stream, call GET /v1/runs/{id}/events?format=json. It returns a page with filters for event types and string length. Over MCP, get_run_events does the same, which is the way to find out why a run failed.
Closing the event stream does not affect the run. You can reconnect with the last event ID you received and continue from there.
Event types
| Type | Recorded when |
|---|---|
status | The run starts running or reaches a final status. |
microvm_ | Ephemeral requests a microVM. |
microvm_ | The microVM is up. |
worker_ | The agent process starts. Includes whether the shell is on. |
connection_ | An MCP connection is ready, with the tools the run may call. |
tool_ | The agent calls a tool. Includes the arguments. |
tool_ | A tool call returns. Includes the result and whether it was an error. A result over 256 KiB is shortened here and carries trimmed_from_bytes. |
text_ | The model streams text, in batches about ten times a second. |
model_ | A model response ends. Token usage as reported by the worker; not used for billing. |
usage | Ephemeral authorizes or reconciles the cost of a model call. |
connection | The engine makes an HTTP request or MCP tool call on the run's behalf. |
web_ | The engine sends a web request for the agent. Includes the URL, status, cost and safety check. |
web_ | The engine runs a web search for the agent. |
web_ | A web request or search was refused before it was sent. Includes the reason. |
result | The agent returns its final output. The run's output field holds all of it; this event may be shortened. |
model_ | A model call was refused, for example because its worst-case cost exceeds what is left of the budget. Includes the reason. |
output_ | A reply reached the model's output limit and the agent was asked to continue. |
output_ | A file the run saved as an output. |
output_ | A path in outputs that the agent did not write. |
progress | The agent reported progress. |
model_ | A model call failed. Includes the reason. |
output_ | The final output was longer than 1 MiB and was cut there. |
events_ | The run record was full, so later events were not stored. Includes how many. |
worker_ | The worker stops with an error. Includes why. |
microvm_ | The microVM is confirmed destroyed. |
microvm_ | Termination could not be confirmed yet and will be retried. |
done | Last message on the stream. Carries the final run object. |
Ephemeral removes known credential values, such as connection tokens, from events and output before storing them. The API reference shows the exact stream format.
Cancelling a run
POST /v1/runs/{id}/cancel stops a run that is reserving, queued, starting or running. The worker is stopped and the microVM is terminated. Cancelling a run that has already finished changes nothing.
Zero data retention
Set zero_data_retention to true on a run, or in a saved workflow, when the task is sensitive. Ephemeral then records nothing of the run's content: you only get the output.
Zero data retention covers what Ephemeral records about a run: its events, output and definition. Files and state a run is told to save are your storage, kept as your retention settings say.
| Kept | Not kept |
|---|---|
| Run ID, organization, status, timestamps, schedule, cost and usage figures, and a generic error category with no worker text. | Events and output once delivered, worker error text (the error stays generic), and the run's definition: prompt, input, file list and connection references. A run's definition cannot be fetched or run again. |
- Events still stream while the run works, through
GET /v1/runs/{id}/eventson any engine. They are held in a transient store and deleted a few minutes after the run ends. - The output is returned once. The first
GET /v1/runs/{id}after the run ends includes it and deletes it. With a callback, the callback delivers it and reads leave it in place until then. Either way it is deleted after at most an hour.output_availableandoutput_expires_atsay whether it is still held. - Model calls go only to providers that neither retain your data nor train on it. A model with no such provider is refused with
400before anything is reserved. - On the hosted service the run costs 10% more: the surcharge applies to the whole run (the run fee, compute, model calls and web requests), counts toward the budget and appears in the cost breakdown. Self-hosted installations charge nothing extra.
- Transient data lives in tables that every backup leaves out, so a restored database never contains it.
After a run
The run keeps its output, error message, timestamps, events and cost. Treat the cost as final once the status is final and billing_pending is false; see budgets and billing.
Finished runs are deleted 30 days after they end, together with their events. A run is kept longer while its billing, callback delivery or microVM cleanup is still pending. Self-hosted installations can change the retention period.
To delete a finished run sooner, use DELETE /v1/runs/{id}, the MCP tool delete_runs or Delete on the run's page in the dashboard: its events, output and definition are deleted at once. What it cost stays charged, and the files it saved stay unless you ask for them to be deleted too.
To run the same task again, fetch GET /v1/runs/{id}/definition. It returns the definition the run actually used, with credentials removed, so you can review it, set a new budget and submit it.