Concepts

Runs

How an AI agent run works: one task in one disposable microVM, from queue to settlement, with statuses, events, timeouts and zero data retention.

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.

POST /v1/runs
{
  "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.

StatusMeaning
reservingHosted only. Credits for the run's budget are being reserved.
queuedWaiting for a free worker slot.
startingTaken from the queue. The definition and files are being loaded.
runningThe microVM is starting or the agent is working.
succeededThe agent finished and returned output.
failedThe 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.
cancelledSomeone cancelled the run.
timed_outThe run reached its timeout before finishing.
interruptedThe 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

LimitValue
timeout_seconds1 to 3,600. Default 300.
Prompt128 KiB
Input1 MiB of JSON
Files32 per run, 1 MiB each, 4 MiB in total
Connections16 per run
Model calls100 per run
Output per model replyThe 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 searches50 per run, when web access is on
OutputUp to 1 MiB. A longer answer is cut there, and the run records that it was.
outputs20 files per run, 10 MiB each and 25 MiB in all
EventsThe 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_cost_micros1 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_missing event, and the run does not fail. Saved files appear as output_file events.
  • A run without a shell cannot write files itself. The agent is given a save_output tool 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.

JSON
{
  "workflow": "investigate-payment",
  "input": { "payment_id": "pay_123" },
  "notify": { "connection": "team-chat", "path": "/hooks/ephemeral", "on": "failure" }
}
  • connection is the name of a saved HTTP connection that allows POST. path is optional and relative to the connection's URL. on is always (default) or failure, to be told only when a run did not succeed.
  • The body is {"event": "run.finished", "run": {…}, "text": "one line"}, with the headers X-Ephemeral-Event: run.finished and X-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 event batch.finished, the batch summary and its runs.
  • A run cannot have both callback and notify. Schedules take notify too.

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 notify to 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

TypeRecorded when
statusThe run starts running or reaches a final status.
microvm_startingEphemeral requests a microVM.
microvm_readyThe microVM is up.
worker_startedThe agent process starts. Includes whether the shell is on.
connection_readyAn MCP connection is ready, with the tools the run may call.
tool_startThe agent calls a tool. Includes the arguments.
tool_endA 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_deltaThe model streams text, in batches about ten times a second.
model_usageA model response ends. Token usage as reported by the worker; not used for billing.
usageEphemeral authorizes or reconciles the cost of a model call.
connectionThe engine makes an HTTP request or MCP tool call on the run's behalf.
web_requestThe engine sends a web request for the agent. Includes the URL, status, cost and safety check.
web_searchThe engine runs a web search for the agent.
web_refusedA web request or search was refused before it was sent. Includes the reason.
resultThe agent returns its final output. The run's output field holds all of it; this event may be shortened.
model_call_refusedA model call was refused, for example because its worst-case cost exceeds what is left of the budget. Includes the reason.
output_limitA reply reached the model's output limit and the agent was asked to continue.
output_fileA file the run saved as an output.
output_missingA path in outputs that the agent did not write.
progressThe agent reported progress.
model_call_failedA model call failed. Includes the reason.
output_truncatedThe final output was longer than 1 MiB and was cut there.
events_skippedThe run record was full, so later events were not stored. Includes how many.
worker_errorThe worker stops with an error. Includes why.
microvm_terminatedThe microVM is confirmed destroyed.
microvm_cleanup_pendingTermination could not be confirmed yet and will be retried.
doneLast 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.

Cancellation cannot undo external actions
If the agent already called an API that changed something, such as issuing a refund, cancelling the run does not reverse it. The same applies to runs that fail, time out or are interrupted. Ephemeral never retries a run automatically, so a side effect is not repeated either.

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.

KeptNot 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}/events on 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_available and output_expires_at say 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 400 before 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.

A run definition keeps the prompt, input and inline file contents you sent. Do not put secrets in them; use a saved connection instead.
esc

Nothing matches “”.