Skip to main content

PandaStack Python SDK

Python SDK for PandaStack, open-source Firecracker microVM sandboxes for AI agents and code execution.

Install

pip install pandastack

Auth

Create a token in the PandaStack dashboard, then export it:

export PANDASTACK_API_KEY=pds_...
# Optional for self-hosted/dev:
export PANDASTACK_API=http://localhost:8080

Client() also reads ~/.config/pandastack/config.json when environment variables are unset.

Quickstart

from pandastack import Sandbox

with Sandbox.create(template="code-interpreter") as sb:
    result = sb.run_code("print(2 + 2)")
    print(result.stdout.strip())

Explicit client

from pandastack import Client

client = Client(api_key="pds_xxx", api_url="https://api.pandastack.ai")
sb = client.sandboxes.create(template="code-interpreter")
try:
    print(sb.exec("ls -la").stdout)
finally:
    sb.kill()

Filesystem

sb.filesystem.write("/home/panda/hello.txt", "hello")
print(sb.filesystem.read("/home/panda/hello.txt"))
sb.filesystem.upload("local.csv", "/home/panda/local.csv")
sb.filesystem.download("/home/panda/out.png", "out.png")

Commands and logs

result = sb.commands.run("python3 --version", timeout=10)
for line in sb.logs(stream="both", follow=False):
    print(line)

Lifecycle

sb.set_ttl(600)
sb.set_persistent(True)
print(sb.lifecycle())
sb.pause()
sb.resume()
snapshot_id = sb.snapshot()

Templates

from pandastack import templates

print(templates.list())
build = templates.build("my-template", rootfs_tar="rootfs.tar", size_mb=2048)
print(build.status)
templates.delete("my-template")

Tokens

from pandastack import tokens

new_token = tokens.create("ci")
print(new_token.token)
for token in tokens.list():
    print(token.prefix, token.name)
tokens.revoke(new_token.prefix)

The old pandastack import remains as a deprecated compatibility alias. Use pandastack for new code.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pandastack-0.9.0.tar.gz (69.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pandastack-0.9.0-py3-none-any.whl (54.6 kB view details)

Uploaded Python 3

File details

Details for the file pandastack-0.9.0.tar.gz.

File metadata

  • Download URL: pandastack-0.9.0.tar.gz
  • Upload date:
  • Size: 69.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.8

File hashes

Hashes for pandastack-0.9.0.tar.gz
Algorithm Hash digest
SHA256 e17d4ade36c20abf961f28d163e94ce3c5546dffb23b259b9c41e0ec7cab52a2
MD5 4772ab14d673aff37a1a73f63091fd67
BLAKE2b-256 e6f292bb6ddff120786c67f9893476d77442f4c9f9a4dd8e8bb1fdceb122029d

See more details on using hashes here.

File details

Details for the file pandastack-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: pandastack-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 54.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.8

File hashes

Hashes for pandastack-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d96d4be64418bc4146e4902c5725eea2e6e42cab71b34ed4d896ad960e5c3c7f
MD5 04b86a529e06e9c51f8666e2f5bbd92c
BLAKE2b-256 143e58270aa9b2d3b0a57bcbc5df0a353c73431fe63f8aae448d814c3654a29c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

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