Gatana logoGatana Docs
Integrations

LangChain Deep Agents

Use Gatana Sandboxes with Langchain Deep Agent

Early Access

The Agentic Sandbox is currently in early access. Features and APIs may change. To enable it for your organization, you can opt-in in the Sandbox page in the Gatana Dashboard.

Gatana provides a Python implementation of the LangChain Deep Agent sandbox backend.

$ uv add gatana-langchain
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.

For more details, see: