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

# LangChain

> Run Deep Agents, LangGraph, and LangChain agents in isolated Superserve sandboxes with langchain-superserve.

`langchain-superserve` adapts a Superserve sandbox to the Deep Agents sandbox protocol. Because Deep Agents compiles to a LangGraph graph, the same backend works across LangChain, LangGraph, and Deep Agents — agent shell commands and file operations run inside an isolated Firecracker microVM instead of on your machine.

## Setup

```bash theme={"theme":{"light":"github-light","dark":"vitesse-dark"}}
pip install langchain-superserve
export ANTHROPIC_API_KEY=sk-ant-...
export SUPERSERVE_API_KEY=ss_live_...
```

Requires Python 3.11+. `langchain-anthropic` ships as a base dependency of Deep Agents, so the Anthropic model used below is already installed. See [API keys](/api-key) to create a Superserve API key.

## Deep Agents SDK

Launch a sandbox from a python-equipped template, wrap it in `SuperserveSandbox`, and pass it as the `backend` to `create_deep_agent(...)` — the agent's shell and file operations then run inside the sandbox:

```python theme={"theme":{"light":"github-light","dark":"vitesse-dark"}}
from deepagents import create_deep_agent
from superserve import Sandbox
from langchain_superserve import SuperserveSandbox

sandbox = Sandbox.create(name="my-agent", from_template="superserve/python-3.11")

try:
    backend = SuperserveSandbox(sandbox=sandbox)
    agent = create_deep_agent(
        model="anthropic:claude-sonnet-5",
        backend=backend,
        system_prompt="You are a coding assistant with a sandboxed shell.",
    )
    result = agent.invoke(
        {"messages": "List the files in /tmp and tell me how many there are."}
    )
    print(result["messages"][-1].content)
finally:
    sandbox.kill()
```

<Note>
  `SuperserveSandbox` synthesizes `ls`/`read`/`edit`/`glob` with in-sandbox `python3`, so launch from a python-equipped image — `superserve/python-3.11`, `superserve/python-ml`, or `superserve/code-interpreter`. `execute`, `grep`, and file upload/download work on any image, including the minimal `superserve/base`.
</Note>

## Deep Agents Code

Installing `langchain-superserve` also registers a `superserve` sandbox provider for [Deep Agents Code](https://docs.langchain.com/deepagents-code) (`dcode`), the terminal coding agent built on the Deep Agents SDK:

```bash theme={"theme":{"light":"github-light","dark":"vitesse-dark"}}
curl -LsSf https://langch.in/dcode | bash
dcode --install langchain-superserve --package
export SUPERSERVE_API_KEY=ss_live_...
dcode --sandbox superserve
```

The provider defaults to the `superserve/python-3.11` template; override it with the `SUPERSERVE_TEMPLATE` environment variable.

## Superserve extras

Beyond the standard Deep Agents backend, Superserve sandboxes support `pause()`/`resume()` for idle cost savings and proxy-brokered [secret binding](/secrets/binding) (`Sandbox.create(secrets=...)`) so real credentials never enter the sandbox. Manage these through the Superserve SDK on the sandbox you pass to `SuperserveSandbox`.

## Resources

<CardGroup cols={2}>
  <Card title="langchain-superserve on GitHub" icon="github" href="https://github.com/superserve-ai/langchain-superserve">
    Browse the source, tests, and release notes.
  </Card>

  <Card title="langchain-superserve on PyPI" icon="box" href="https://pypi.org/project/langchain-superserve/">
    Install the package and check released versions.
  </Card>
</CardGroup>
