> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenfactory.nebius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sandboxes cookbook

> Complete Sandboxes workflows with explicit state, expected outcomes, and failure handling.

Build on the [main Sandboxes jobs](/sandboxes/overview#when-to-use-sandboxes): agent execution, testing and evaluation, and data processing. The recipes below cover individual steps you can combine into those workflows. Each includes setup instructions, a complete program, expected output, and guidance for handling failures and saved state.

## Prepare and reuse

<Columns cols={2}>
  <Card title="Prepare once, reuse safely" icon="layer-group" href="/sandboxes/cookbook/prepare-once-reuse-safely">
    **Python SDK** · Read the same prepared input in two independent runs.
  </Card>

  <Card title="Build and refresh a custom environment" icon="hammer" href="/sandboxes/cookbook/build-reusable-custom-environment">
    **CLI** · Build an image, reuse it, and rebuild after a change.
  </Card>
</Columns>

## Run and observe

<Columns cols={2}>
  <Card title="Stream a build or test run" icon="spinner" href="/sandboxes/cookbook/stream-a-build-or-test-run">
    **REST SSE** · Watch test output, reconnect, and check the result.
  </Card>

  <Card title="Interact with a process" icon="terminal" href="/sandboxes/cookbook/interact-with-a-process">
    **REST** · Send two lines to a child and collect its response.
  </Card>

  <Card title="Generate and download a binary artifact" icon="download" href="/sandboxes/cookbook/generate-and-download-binary-artifact">
    **Python SDK** · Download a gzip file and check its contents and digest.
  </Card>
</Columns>

## Test and recover

<Columns cols={2}>
  <Card title="Try two coding fixes" icon="code-branch" href="/sandboxes/cookbook/try-two-coding-fixes">
    **Python SDK** · Compare two patches and continue from the passing one.
  </Card>

  <Card title="Verify with networking disabled" icon="ban" href="/sandboxes/cookbook/verify-with-networking-disabled">
    **REST** · Read prepared input in an operation with networking disabled.
  </Card>

  <Card title="Run a bounded evaluation batch" icon="list-check" href="/sandboxes/cookbook/run-bounded-evaluation-batch">
    **REST with Python** · Separate passing tests, failing tests, and cancelled work.
  </Card>

  <Card title="Recover from a known-good image" icon="rotate" href="/sandboxes/cookbook/recover-from-known-good-image">
    **Python SDK** · Correct a failed check and retry from the saved image.
  </Card>
</Columns>

## Framework integration status

<Warning>
  The [Mini-SWE-Agent adapter](/sandboxes/sdk/integrations/mini-swe-agent) currently has an SDK compatibility issue: `ContreeEnvironment` uses removed configuration imports and an incompatible client interface. Its example stops with `RuntimeError`.
</Warning>

Use the recipes above to implement execution, file transfer, and state reuse directly. Before adopting the Mini-SWE-Agent adapter, check its integration page for a compatible adapter and SDK version pair.

Start with [Set up access](/sandboxes/start/set-up-access), then read [Execution lifecycle](/sandboxes/concepts/execution-lifecycle) for the shared state model.
