gatana-langchain
A LangChain sandbox backend for Gatana. Use Gatana sandboxes as isolated execution environments for LangChain deep agents.
Features
- Drop-in sandbox backend for LangChain's
deepagentsframework - Isolated command execution, file upload/download, and full filesystem tool support
- Auto-creates and cleans up sandboxes via context manager
- Fully typed with PEP 561 support
- Python 3.11+
Installation
pip install gatana-langchain
Or with uv:
uv add gatana-langchain
Basic usage
Create a Gatana sandbox and pass it as the backend to a deep agent. The agent gets filesystem tools (ls, read_file, write_file, edit_file, glob, grep) and an execute tool for running shell commands — all inside the sandbox.
from gatana_client import GatanaClient
from langchain_anthropic import ChatAnthropic
from deepagents import create_deep_agent
from gatana_langchain import GatanaSandbox
# Env variables: GATANA_API_KEY and GATANA_ORG_ID
# Or, ~/.gatana.config
client = GatanaClient()
with GatanaSandbox(client=client) as backend:
agent = create_deep_agent(
model=ChatAnthropic(model="claude-sonnet-4-20250514"),
system_prompt="You are a coding assistant with sandbox access.",
backend=backend,
)
result = agent.invoke(
{
"messages": [
{
"role": "user",
"content": "Create a Python script that prints the Fibonacci sequence and run it",
}
]
}
)
print(result["messages"][-1].content)
# Sandbox is automatically deleted when the `with` block exits.
See the gatana-client configuration for the environment variables and the ~/.gatana.config file. You can also pass credentials explicitly:
client = GatanaClient(org_id="YOUR_ORG_ID", token="your-gatana-pat")
Wrapping an existing sandbox
If you already have a sandbox ID (e.g. from a previous session), pass it directly. The sandbox will not be auto-deleted on exit:
backend = GatanaSandbox(client=client, sandbox_id="existing-sandbox-id")
result = backend.execute("echo hello from existing sandbox")
print(result.output)
Running commands directly
You can call execute() without creating an agent:
with GatanaSandbox(client=client) as backend:
result = backend.execute("python --version")
print(result.output) # e.g. "Python 3.12.0\n"
print(result.exit_code) # 0
Uploading and downloading files
Seed the sandbox with files before the agent runs, or retrieve artifacts afterwards:
with GatanaSandbox(client=client) as backend:
# Upload files into the sandbox
backend.upload_files(
[
("/src/main.py", b"print('Hello')\n"),
("/pyproject.toml", b"[project]\nname = 'my-app'\n"),
]
)
# Run the agent or execute commands...
backend.execute("cd /src && python main.py")
# Download artifacts from the sandbox
results = backend.download_files(["/src/main.py"])
for r in results:
if r.content is not None:
print(f"{r.path}: {r.content.decode()}")
else:
print(f"Failed to download {r.path}: {r.error}")
Development
This package holds the Python dev setup for both Python packages in this repository: the dev
dependency groups, the ruff, mypy and pytest config, the pre-commit hook and the tests. It installs
gatana-client from packages/gatana-python in editable mode. You need
uv and just.
Run these from the repository root:
just py-init # install the dependencies and the pre-commit hook
just py-install # install the dependencies only
just py-lint # ruff check and format check
just py-format # format and fix lint issues
just py-typecheck # mypy on gatana_langchain
just py-test # pytest
just py-test-cov # pytest with a coverage report
just py-build gatana-langchain # build the sdist and wheel into dist/
just py-clean # remove build artifacts and caches
Releasing
just release in the repository root releases every package with changes, this one included. To
release only this package:
just py-release gatana-langchain patch # checks, tag and GitHub release
just py-release gatana-langchain patch publish # also publish to PyPI
py-release runs the lint, type check and tests first. It needs a clean package folder.
License
MIT. Copyright (c) 2026 Gatana.
Metadata
Release files for gatana-langchain 2.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gatana_langchain-2.0.3.tar.gz | 6.0 kB | Without provenance | Details for gatana_langchain-2.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gatana_langchain-2.0.3-py3-none-any.whl | Python 3 | none | any | Details for gatana_langchain-2.0.3-py3-none-any.whl |
Total release size: 12.3 kB
Release files / gatana_langchain-2.0.3.tar.gz
| Download URL | gatana_langchain-2.0.3.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d963a4524010b338e280ccf0387773a5fbb06b1593c0bf85b3eae61246d31ddc
|
|
BLAKE2b-256 checksum How to use checksums |
c741d7348dab66348525fc293e22e6dc69d0167cda66d603993fcaee87798e02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / gatana_langchain-2.0.3-py3-none-any.whl
| Download URL | gatana_langchain-2.0.3-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97579d235883c224f420ca910a1d8b38410e36490ac2205f283e9457d50472f0
|
|
BLAKE2b-256 checksum How to use checksums |
79ebf198fa1a46c3af0b502a8991663c72307f0af67d0103b7de4bb5f0cca88a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for gatana-langchain 2.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.