Skip to main content
Daytona provides fast-starting sandbox environments with multi-language support. See the Daytona docs for signup, authentication, and platform details.

Installation

pip install langchain-daytona

Create a sandbox backend

In Python, you create the sandbox using the provider SDK, then wrap it with the deepagents backend.
from daytona import Daytona

from langchain_daytona import DaytonaSandbox

sandbox = Daytona().create()
backend = DaytonaSandbox(sandbox=sandbox)

result = backend.execute("echo hello")
print(result.output)

Use with deepagents

from daytona import Daytona
from langchain_anthropic import ChatAnthropic

from deepagents import create_deep_agent
from langchain_daytona import DaytonaSandbox

sandbox = Daytona().create()
backend = DaytonaSandbox(sandbox=sandbox)

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 hello world Python script and run it"}
        ]
    }
)

Cleanup

You are responsible for managing the sandbox lifecycle via the Daytona SDK. When you are done, stop or destroy the sandbox. See also: Sandboxes.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.