Skip to main content

langchain-pandastack

Run Deep Agents in PandaStack sandboxes. Each sandbox is its own Firecracker microVM, so the code an agent writes runs away from your machine.

This package gives you two things:

  • PandaStackSandbox, a sandbox backend for the Deep Agents SDK.
  • a pandastack sandbox provider for Deep Agents Code (dcode --sandbox pandastack).

Install

pip install langchain-pandastack

You need a PandaStack API key. Create one in the dashboard and export it:

export PANDASTACK_API_KEY=pds_...

Deep Agents SDK

Create a sandbox with the PandaStack SDK and wrap it:

from deepagents import create_deep_agent
from langchain_anthropic import ChatAnthropic
from langchain_pandastack import PandaStackSandbox
from pandastack import Sandbox

sandbox = Sandbox.create(template="base", ttl_seconds=30 * 60)
backend = PandaStackSandbox(sandbox=sandbox)

agent = create_deep_agent(
    model=ChatAnthropic(model="claude-sonnet-4-6"),
    system_prompt="You are a Python coding assistant with sandbox access.",
    backend=backend,
)

try:
    result = agent.invoke(
        {"messages": [{"role": "user", "content": "Write and run a hello world script."}]}
    )
    print(result["messages"][-1].content)
finally:
    sandbox.kill()

You can also call the backend directly:

result = backend.execute("python3 --version")
print(result.output, result.exit_code)

PandaStackSandbox does not create or delete sandboxes. You do that with the PandaStack SDK, so you keep control of templates, snapshots and forks.

Deep Agents Code

Install the package into the dcode environment, then pick the provider:

dcode --install langchain-pandastack --package
export PANDASTACK_API_KEY=pds_...
dcode --sandbox pandastack

dcode creates a sandbox when the session starts and deletes it when the session ends. To attach to a sandbox you already have:

dcode --sandbox pandastack --sandbox-id <sandbox-id>

Settings

Variable Default Meaning
PANDASTACK_API_KEY (required) Your API key. Without it, the key saved by pandastack login is used.
PANDASTACK_API PandaStack cloud API address, for a self-hosted PandaStack.
PANDASTACK_TEMPLATE base Template for new sandboxes.
PANDASTACK_SANDBOX_TTL 1800 Seconds of idle time after which PandaStack stops the sandbox.

Each variable can also be set with a DEEPAGENTS_CODE_ prefix (DEEPAGENTS_CODE_PANDASTACK_API_KEY). The prefixed one wins.

Things to know

  • Working directory. Commands run in /workspace. Pass workdir= to change it.
  • One output. A command's stdout and stderr come back together, in the order the command wrote them.
  • Timeouts. A command gets 30 minutes by default. Pass timeout= to execute(), or timeout=0 for no limit. A command that hits its limit is stopped inside the sandbox and returns exit code 124 with the output it had produced.
  • Background processes. A command can start a server with & and return. The process keeps running in the sandbox and does not keep the call open.
  • Lost connection. If the connection to the sandbox drops before a command reports an exit code, execute() returns exit_code=None. The command may have finished or not, so check before running it again.
  • Idle sandboxes stop. PandaStack stops a sandbox after its idle time (ttl_seconds). The Deep Agents Code provider sets 30 minutes.
  • Template needs. The sandbox needs base64 and mktemp for every command, timeout for time limits, and python3 for the file tools (read, edit, grep, glob). PandaStack's own templates have all of them. In a custom template without timeout, commands run with no limit.

Development

uv sync --group test
make test
make lint

Integration tests create real sandboxes and need a key:

PANDASTACK_API_KEY=pds_... make integration_test

License

Apache-2.0

Metadata

Release files for langchain-pandastack 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-pandastack 0.1.0
File Size Uploaded Provenance Actions
langchain_pandastack-0.1.0.tar.gz 310.2 kB Without provenance Details for langchain_pandastack-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-pandastack 0.1.0
File Interpreter ABI Platform Actions
langchain_pandastack-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_pandastack-0.1.0-py3-none-any.whl

Total release size: 325.9 kB

Release files / langchain_pandastack-0.1.0.tar.gz

Download URL langchain_pandastack-0.1.0.tar.gz
Size 310.2 kB
Tags Source
SHA-256 checksum
How to use checksums
163fb2d3222d368d2fc41aade543a5a5e027c01564d0761a627650c4de8044da
BLAKE2b-256 checksum
How to use checksums
481f67957d373006e30391867fcee3044447e8264f8a69dcf2fc0cef1fcef142
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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 / langchain_pandastack-0.1.0-py3-none-any.whl

Download URL langchain_pandastack-0.1.0-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba0f9a0ba9e255e539e728cffea97a6cd4927f0dc47da25474845b7decc3ed4d
BLAKE2b-256 checksum
How to use checksums
6ff71e9d8e4f5239301a05d2e64c45a2ffc2f3cf8480c796cf0acc626fe5b30f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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 langchain-pandastack 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page