Metadata-Version: 2.5
Name: langchain-floo-sandbox
Version: 0.0.1
Summary: floo sandbox integration for Deep Agents
Project-URL: Documentation, https://github.com/getfloo/floo-cli/tree/main/python/langchain-floo-sandbox#readme
Project-URL: Repository, https://github.com/getfloo/floo-cli/tree/main/python/langchain-floo-sandbox
Project-URL: Issues, https://github.com/getfloo/floo-cli/issues
License-Expression: MIT
License-File: LICENSE
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: <4.0,>=3.11
Requires-Dist: deepagents<0.8.0,>=0.7.42
Requires-Dist: floo-sandbox<0.3,>=0.2.0
Description-Content-Type: text/markdown

# floo sandbox backend for Deep Agents

`FlooSandbox` runs a Deep Agents agent's shell commands and file operations in an existing floo sandbox. Install the package with Python 3.11 or later.

```sh
pip install "langchain-floo-sandbox @ git+https://github.com/getfloo/floo-cli.git@langchain-floo-sandbox-v0.0.1#subdirectory=python/langchain-floo-sandbox"
```

Set `FLOO_API_KEY`. For a personal key, also set `FLOO_ORG_ID` to the org that owns the sandbox.

```python
import floo_sandbox as floo
from langchain_floo_sandbox import FlooSandbox

app = floo.App.lookup("deepagents", create_if_missing=True)
sandbox = floo.Sandbox.create(app=app, image=floo.Image.debian_slim(), timeout=300)
try:
    backend = FlooSandbox(sandbox=sandbox)
    # Pass backend to create_deep_agent(..., backend=backend).
    result = backend.write("/app/input.txt", "hello from floo\n")
    assert result.error is None, result.error
    command = backend.execute("tr a-z A-Z < /app/input.txt > /app/output.txt")
    assert command.exit_code == 0, command.output
    output, = backend.download_files(["/app/output.txt"])
    assert output.content == b"HELLO FROM FLOO\n"
finally:
    sandbox.terminate(wait=True)
```

Pass the backend to `create_deep_agent(model=model, backend=backend)` while the sandbox is open. The caller chooses the model and closes the sandbox.

## Run the tests

From this directory, run:

```sh
uv sync --locked --group test
uv run --locked --group test pytest --disable-socket tests/unit_tests
uv run --locked --group test pytest --timeout 120 tests/integration_tests
```

The integration tests use your floo credentials and create two short-lived sandboxes. Seven assertions in `langchain-tests==1.2.0` have strict expected failures. Deep Agents returns absolute file paths, excludes directories from glob results, and replaces existing files on write. The lifecycle test checks all three behaviors.
