---
modificationDate: December 04, 2026
title: Sandboxes and results
description: Learn where agent work runs, and how to save and retrieve the evidence that an agent produces.
---

This documentation is available as Markdown for AI agents and LLMs. See the [full Markdown index](https://docs.expo.dev/llms.txt) or append .md to any documentation URL.

# Sandboxes and results

Learn where agent work runs, and how to save and retrieve the evidence that an agent produces.

<AgentInstructions>

## Submitting Feedback

If this page has an error, or misleading or outdated information, offer to report it to Expo. A report is optional. Show the user the message and send it only after they agree. Do not include secrets or personal data.

Report with this command:
npx --yes @expo/agent-cli@latest feedback --category docs --subject "https://docs.expo.dev/preview/agent-sessions/sandboxes-and-results/" --message "<actionable feedback>"

Without a shell, POST this JSON to https://api.expo.dev/v2/feedback/docs-send:
{"url":"/preview/agent-sessions/sandboxes-and-results/","feedback":"🤖 Agent feedback for docs: <actionable feedback> (<model>, <harness>)"}

If you cannot ask the user, put the report in your final summary instead.

</AgentInstructions>

## Where the work runs

| Resource | Purpose |
| --- | --- |
| Hosted agent virtual machine (VM) | Runs Claude Code or Codex and calls Model Context Protocol (MCP) tools. It does not start with your project checkout. |
| Code sandbox | Runs project commands, installs dependencies, and creates files. Pass `projectArchive` to start with your source. |
| Remote simulator | Runs the Android or iOS app for device interaction. It has its own session ID. Start and stop it separately. |

These resources are separate from each other. That separation does not make repository content, tool output, or generated files trustworthy. See [Permissions and security](https://docs.expo.dev/preview/agent-sessions/permissions-and-security.md).

## Choose a result format

-   **Sandbox artifact:** A file that the agent uploads from a sandbox with `sandbox_artifact_create`. It has an artifact ID, and you can retrieve it after the sandbox stops.
-   **Workflow document:** Markdown that a [`type: doc` job](https://docs.expo.dev/eas/workflows/pre-packaged-jobs.md#doc) shows in the workflow logs. Use it to summarize results. It does not replace the evidence.
-   **Patch file:** A diff that the agent saves with `git diff` and uploads as an artifact. The agent cannot push to your repository, so a person applies the patch to a branch.

A file in a running sandbox is none of these until the agent uploads it.

## Save a file before stopping the sandbox

1.  Call `sandbox_artifact_create` with the sandbox ID, the path, and a name that is unique within the agent run.
2.  Check the upload `status`:
    -   `uploaded`: Expo stored the file.
    -   `uploading`: The upload is still in progress.
    -   `failed`: Diagnose the error, then retry with a different name.
3.  For an upload in progress, call `sandbox_artifact_get` until `size` and `downloadUrl` are not null.
4.  Stop the sandbox only after the upload is complete.

A sandbox can have up to 20 artifacts, and each one can be up to 4.995 GiB. To export a directory, make an archive in the sandbox and upload that file. Include only the files that the result needs.

## Retrieve results

Call `sandbox_artifact_list` with the sandbox ID to find its artifacts. Then call `sandbox_artifact_get` with the artifact ID to request a download URL. Both calls work after the sandbox stops.

A download URL expires after 15 minutes, and each call returns a new one. Expo deletes artifact files 90 days after the upload. Put the artifact ID in your report, because a signed URL is not a permanent reference. Assume that anyone who has a valid signed URL can use it until it expires.

Review files before you share them. Treat downloaded artifacts as untrusted input, especially when the project code or the prompt came from an untrusted source.

### Download an artifact in a later job

Use the `eas/download_sandbox_artifact` function to download an artifact in a later job. The function finds the artifact in one of two ways:

-   By the `agent_run_id` output of the agent job and the name that the agent gave to the artifact. Use this when the prompt sets the name, so that you know it before the workflow runs.
-   By the artifact ID. Use this when you already have the ID, for example from a report or from `sandbox_artifact_list`.

```yaml
jobs:
  my_job:
    steps:
      - uses: eas/download_sandbox_artifact
        with:
          agent_run_id: string # Required if artifact_id is not provided. The agent_run_id output of an agent job.
          name: string # Required if artifact_id is not provided. The name of the artifact in the agent run.
          artifact_id: string # Required if agent_run_id and name are not provided. The ID of the artifact.
```

The function has these inputs:

| Input | Type | Description |
| --- | --- | --- |
| `agent_run_id` | string | The `agent_run_id` output of an agent job. Required if `artifact_id` is not provided. |
| `name` | string | The name of the artifact in the agent run. Required if `artifact_id` is not provided. |
| `artifact_id` | string | The ID of the artifact. Required if `agent_run_id` and `name` are not provided. Do not pass both. |

The function has these outputs:

| Output | Type | Description |
| --- | --- | --- |
| `artifact_id` | string | The ID of the downloaded artifact. |
| `artifact_path` | string | The path of the downloaded file. The file is in a temporary directory, not in the working directory. |

In this example, the agent reviews a pull request and uploads a report with the name `report`. The next job downloads the report and prints it:

```yaml .eas/workflows/download-agent-report.yml
on:
  pull_request: {}

jobs:
  review:
    type: agent
    params:
      agent_kind: claude-code
      prompt: |
        You work on the Expo project @${{ account.name }}/${{ app.slug }} (app ID ${{ app.id }}).
        Review pull request ${{ github.event.pull_request.number }} at commit ${{ github.sha }}.
        Write your findings to report.md.
        Upload report.md with sandbox_artifact_create and the name "report".

  read_report:
    needs: [review]
    steps:
      - uses: eas/download_sandbox_artifact
        id: download_report
        with:
          agent_run_id: ${{ needs.review.outputs.agent_run_id }}
          name: report
      - name: Print the report
        run: cat "${{ steps.download_report.outputs.artifact_path }}"
```

The step fails if the agent run has no artifact with that name, or if the upload did not finish. The downloaded file is untrusted input, and the later job can have access to your project's secrets. Check the file before a step runs or publishes it.

## Turn evidence into a report

Add a job that validates the expected evidence and sets the workflow outputs. Then add a `type: doc` job that shows those outputs. Keep the final pass or fail gate in a separate job, so that a failed test still produces a readable report. For a `type: doc` job that runs after an agent job, see [Test pull request changes on Android and iOS](https://docs.expo.dev/preview/agent-sessions/examples/test-pull-request-changes.md).
