Skip to content
View as Markdown

LangChain & deepagents ​

sandrpod ships a LangChain backend, so a deepagents agent can use a sandbox on hardware you own instead of a hosted service.

bash
pip install langchain-sandrpod
python
import os
from langchain_sandrpod import SandrPodClient
from deepagents import create_deep_agent

client = SandrPodClient(api_url=os.environ["SANDRPOD_API_URL"],
                        token=os.environ["SANDRPOD_API_TOKEN"])

sb = client.get_sandbox("my-sandbox")
agent = create_deep_agent(model=model, backend=sb)
result = agent.invoke({"messages": [{"role": "user", "content": "plot the data in /workspace"}]})

Or let the client manage the sandbox lifetime:

python
with client.sandbox("temp-sb") as sb:
    agent = create_deep_agent(model=model, backend=sb)
    agent.invoke({"messages": [{"role": "user", "content": "ls"}]})
# sandbox deleted on exit

Environment ​

VariableMeaning
SANDRPOD_API_URLyour control plane
SANDRPOD_API_TOKENan sk_ workspace key, or the platform token

If you already use langchain-e2b ​

Both backends drive the same twelve behaviours in the deepagents integration. The E2B one works against SandrPod unchanged once E2B_DOMAIN points at your server — see E2B drop-in. Choosing between them is a matter of which package you already depend on, not which is more capable.

Recipes ​

WantDo
Isolate one taskwith client.sandbox(...) — deleted on exit
Reuse a prepared environmentsnapshot a sandbox after setup, then create from that image
Stop an agent reaching the networkcreate with --allow-domain and list only what it needs
Keep a long conversation's filescreate once, pass the same sandbox to every turn

Apache 2.0 — your clouds, your machines, your rules.