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

# OpenAI Agents SDK sandbox provider

> Run the Python Agents SDK shell and file tools in a floo sandbox, then restore the workspace on a later run.

Pass a `FlooSandboxClient` to the OpenAI Agents SDK to run shell commands and edit files under `/workspace`. The SDK manages model calls and approvals. floo runs the commands.

## Install the provider

Version 0.1.0 requires Python 3.11 or newer and installs `openai-agents==0.26.0` and `floo-sandbox==0.2.0`. Install the provider from PyPI:

```sh theme={null}
python -m pip install openai-agents-floo==0.1.0
```

## Run a command

Set `FLOO_API_KEY` to a floo API key with sandbox access and `FLOO_APP_NAME` to an existing app in that org. If your key can access multiple orgs, set `FLOO_ORG_ID` to the target org ID. See [sandbox availability by plan](https://getfloo.com/docs/guides/sandbox-limits.md).

This example uses a scripted model so you can test the SDK and floo with only your floo credentials. It checks the actual shell output before printing it.

```python theme={null}
import asyncio
import os

from agents import RunConfig, Runner
from agents.sandbox import SandboxAgent, SandboxRunConfig
from agents.testing import ScriptedModel, assistant_message, function_call
from openai_agents_floo import FlooSandboxClient


async def main():
    client = FlooSandboxClient(os.environ["FLOO_APP_NAME"])
    model = ScriptedModel([
        [function_call("exec_command", {"cmd": "printf 'hello from floo' > result.txt && cat result.txt"}, call_id="write-file")],
        [assistant_message("Done")],
    ])
    agent = SandboxAgent(name="Workspace check", model=model)
    config = RunConfig(tracing_disabled=True, sandbox=SandboxRunConfig(client=client))
    result = await Runner.run(agent, "Write and read result.txt", run_config=config)
    output = next(item.output for item in result.new_items if item.type == "tool_call_output_item")
    assert "hello from floo" in str(output), output
    print(output)


asyncio.run(main())
```

To let a model choose the commands, pass your configured model to `SandboxAgent` and supply its credentials to the application.

## Resume a workspace

The runner closes a session it creates. To continue a paused run, save the SDK run state and keep the local snapshot directory available to the worker that resumes it. Import `openai_agents_floo` in that worker. A live sandbox can reconnect by its saved identity. After termination, the provider restores workspace files and their modes into a new sandbox.

When your application calls `client.create()` directly, it owns the session. Pass a `LocalSnapshotSpec` to preserve files after termination, call `await session.aclose()` to save and close, and call `await client.delete(session)` in a cleanup block. The [provider README and runnable tests](https://github.com/getfloo/floo-cli/tree/main/python/openai-agents-floo) cover both lifecycles.

## Execution limits

Commands run as the guest’s default user with outbound networking blocked. The provider supports one-shot commands and inline file and directory entries. Interactive terminals, exposed ports and host mounts are unsupported in 0.1.0. The snapshot covers workspace files. System packages and background processes belong to the original sandbox.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.