Skip to main content

zygo — Python client

Run code you did not write — a customer's script, a plugin, something an LLM just generated — without letting it touch your host. Zygo keeps a warm sandbox per runtime, forks a fresh process for each request inside namespaces, cgroups and seccomp, and answers in about a millisecond. This package is the Python side of that: register a script once, then call it with JSON in and JSON out.

Before you start

This package is a client. The sandboxes are run by zygo, one static binary for Linux; on macOS it runs everything in a Linux VM it manages, and the API it starts there answers on the Mac at the same address. Install it as the project's README shows, then:

zygo doctor                                    # can this host run sandboxes?
zygo pull python:3.12-slim                     # the API never pulls an image itself
export ZYGO_API_TOKEN=$(openssl rand -hex 16)  # `zygo api` will not start without one
zygo api --allow-deploy                        # 127.0.0.1:7700; leave it running

--allow-deploy lets a client start functions and one-shot sandboxes. The first example calls a function named resize that a sandbox.toml declares and zygo up starts; chapter 11 of the Zygo book walks through one. zygo.connect() finds the API at ZYGO_API_URL, or http://127.0.0.1:7700, and sends ZYGO_API_TOKEN, so a program started from the same shell needs no settings.

Using it

pip install zygo-sdk      # then `import zygo_sdk`
import zygo_sdk as zygo

client = zygo.connect()                 # `zygo api`, on loopback or a unix socket
resize = client.fn("resize")            # a function declared in sandbox.toml

out = resize({"url": "https://example.com/a.png"})
print(out.result, out.metrics.wall_ms)

Asynchronous, which is what an agent framework needs — the same methods, every one a coroutine:

import asyncio
import zygo_sdk as zygo

async def main(events):
    async with zygo.aio.connect() as client:
        return await asyncio.gather(*(client.call("resize", e) for e in events))

asyncio.run(main([{"url": "https://example.com/a.png"}]))

A refused request can be retried for you. Busy (the pool was full) and Unavailable (the host is still building or warming something) both mean the request never ran, so sending it again is safe; nothing else is retried:

client = zygo.connect(retries=3)        # waits the server's Retry-After, then again

A one-shot sandbox, needing nothing declared in advance:

r = client.run("python:3.12-slim", ["python3", "-c", "print(6 * 7)"], mem="128M")
print(r.stdout)

No dependencies. The standard library has an HTTP client, and a unix socket is thirty lines on top of it.

Full documentation: docs/book/17-api-sdk-mcp.md. The project: zygo.

Tests

python -m unittest discover -s tests

They run against a stand-in API and need no Linux, no kernel and no sandbox: what is under test is the client. A test that needs a real sandbox belongs in the Rust suites, against a real kernel.

Metadata

Release files for zygo-sdk 0.1.8

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

Source distribution (sdist)

Source distribution for zygo-sdk 0.1.8
File Size Uploaded Provenance Actions
zygo_sdk-0.1.8.tar.gz 54.2 kB With provenance Details for zygo_sdk-0.1.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zygo-sdk 0.1.8
File Interpreter ABI Platform Actions
zygo_sdk-0.1.8-py3-none-any.whl Python 3 none any Details for zygo_sdk-0.1.8-py3-none-any.whl

Total release size: 95.6 kB

Release files / zygo_sdk-0.1.8.tar.gz

Download URL zygo_sdk-0.1.8.tar.gz
Size 54.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c69b9cfcfbcfe691e4d7b24e6150ff91322613847f5966f17debcac26bdea4f1
BLAKE2b-256 checksum
How to use checksums
ceb1006a24cb3487a326e1de0fbc4bb8df2735cfe04bc964b138d6543686286a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / zygo_sdk-0.1.8-py3-none-any.whl

Download URL zygo_sdk-0.1.8-py3-none-any.whl
Size 41.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9aff710b74022c07c9c9b1a848640652930ae2994c65e93d2141e7ec5f5ed291
BLAKE2b-256 checksum
How to use checksums
d5694c725830c867542e0a31ee4aad8d27aef49bdbc8395f13f06020068cf8dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for zygo-sdk 0.1.8

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for zygo_sdk-0.1.8.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

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.

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