> ## 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](https://docs.tokenfactory.nebius.com/sandboxes/overview.md#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

> [card] [Prepare once, reuse safely](https://docs.tokenfactory.nebius.com/sandboxes/cookbook/prepare-once-reuse-safely.md)
>
> **Python SDK** · Read the same prepared input in two independent runs.

> [card] [Build and refresh a custom environment](https://docs.tokenfactory.nebius.com/sandboxes/cookbook/build-reusable-custom-environment.md)
>
> **CLI** · Build an image, reuse it, and rebuild after a change.

## Run and observe

> [card] [Stream a build or test run](https://docs.tokenfactory.nebius.com/sandboxes/cookbook/stream-a-build-or-test-run.md)
>
> **REST SSE** · Watch test output, reconnect, and check the result.

> [card] [Interact with a process](https://docs.tokenfactory.nebius.com/sandboxes/cookbook/interact-with-a-process.md)
>
> **REST** · Send two lines to a child and collect its response.

> [card] [Generate and download a binary artifact](https://docs.tokenfactory.nebius.com/sandboxes/cookbook/generate-and-download-binary-artifact.md)
>
> **Python SDK** · Download a gzip file and check its contents and digest.

## Test and recover

> [card] [Try two coding fixes](https://docs.tokenfactory.nebius.com/sandboxes/cookbook/try-two-coding-fixes.md)
>
> **Python SDK** · Compare two patches and continue from the passing one.

> [card] [Verify with networking disabled](https://docs.tokenfactory.nebius.com/sandboxes/cookbook/verify-with-networking-disabled.md)
>
> **REST** · Read prepared input in an operation with networking disabled.

> [card] [Run a bounded evaluation batch](https://docs.tokenfactory.nebius.com/sandboxes/cookbook/run-bounded-evaluation-batch.md)
>
> **REST with Python** · Separate passing tests, failing tests, and cancelled work.

> [card] [Recover from a known-good image](https://docs.tokenfactory.nebius.com/sandboxes/cookbook/recover-from-known-good-image.md)
>
> **Python SDK** · Correct a failed check and retry from the saved image.

## Framework integration status

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

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](https://docs.tokenfactory.nebius.com/sandboxes/start/set-up-access.md), then read [Execution lifecycle](https://docs.tokenfactory.nebius.com/sandboxes/concepts/execution-lifecycle.md) for the shared state model.
