Skip to main content

Zeroshot Python SDK

Install from PyPI with Python 3.11 or newer:

python -m pip install the-open-engine-zeroshot

Import the package as zeroshot. Pip selects the wheel for your OS and CPU. See the Python SDK guide for setup and examples.

zeroshot is the open-source engine for autonomous software production. Its workflow engine orchestrates coding agents through a graph of implementation, code review, testing and repair. zeroshot is a typed async client for its run engine. Each platform wheel contains the matching zeroshot executable. Python supplies async calls and typed result objects; the executable remains authoritative for graph validation, run state, template expansion, and runtime/provider rules.

import asyncio

from zeroshot import Client, UniformRuntime

async def main() -> None:
    runtime = UniformRuntime(
        harness="codex",
        provider="openrouter",
        model="PROVIDER_MODEL_ID",
        effort="max",
    )

    async with Client(runtime=runtime) as client:
        result = await client.run(
            "Implement the requested change and run the relevant tests.",
            wait_timeout=21_600,
        )

    result.raise_for_failure()


if __name__ == "__main__":
    asyncio.run(main())

Client() defaults to LocalTarget() and Preset("software-change"), but it never guesses a harness, provider, or model. run() submits one durable graph run and waits for its terminal result. submit() returns a Run immediately for status, resumable watch/log streams, waiting, or durable force-stop control.

For local Windows hosts that forbid Job breakaway, select LocalTarget(controller="contained"). The default is "detached". The setting applies to submission, resume and answer. Contained mode retains native caller Job policy and runtime-owned descendant cleanup; it promises neither termination with the caller nor survival of host closure. Closing an observing CLI alone does not establish controller loss. Use Run.force_stop() for explicit cleanup. Linux/macOS launch behavior is unchanged.

Local, direct, and hosted targets

Local runs use the folder captured when the client opens. Set LocalTarget.workspace or per-run cwd= to select another folder; relative cwd paths use that captured workspace. Agents write in place. Without Git delivery, plain folders work; push needs committed Git and a remote, while PR and merge need a supported forge (GitHub today).

from zeroshot import Client, UniformRuntime


async def run_local(runtime: UniformRuntime) -> None:
    async with Client(runtime=runtime) as client:
        result = await client.run(
            "Update the parser.",
            cwd="/path/to/repository",
            worktree=True,
        )

    result.raise_for_failure()

worktree=True creates a retained Git worktree on a managed branch for local execution; it is also accepted by submit(). It defaults to False (run in place). Omitting worktree_base, or setting it to "local", starts at the invoking checkout's exact HEAD. Set worktree_base="remote" to fetch and start at the invoking branch's upstream, which must exist. Only committed files are included; uncommitted changes, untracked files and dependencies are not copied, and dependencies are not installed. Worktrees remain after completion: use git worktree list and explicitly clean up with git worktree remove PATH when finished.

Native preflight rejects a base without worktree=True, unsupported bases, and worktree=True with DirectTarget or HostedTarget, before target contact or controller startup.

For an unauthenticated Docker deployment or another direct target, select DirectTarget:

from zeroshot import Client, DirectTarget, UniformRuntime


async def run_direct(runtime: UniformRuntime) -> None:
    target = DirectTarget("http://127.0.0.1:8080")

    async with Client(target=target, runtime=runtime) as client:
        result = await client.run("Inspect the repository and report success.")

    result.raise_for_failure()

Docker/direct and hosted targets require a committed Git source. Per-run repository= accepts a credential-free HTTPS/SSH Git URL or GitHub owner/name; branch= and revision= override source selection. source_connection= selects a named connection used only for checkout and delivery.

HostedTarget reuses a named target and login from the CLI. A stack is an atomic, immutable DAG of runs over one repository, base branch, and hosted profile, submitted at once. delivery chooses how it lands:

  • "merge": the profile contains exactly one Git merge delivery node (builtin.git-delivery.merge@2 or @3). Each run merges into the base branch before its dependents start, and a run may need several others.
  • "stacked_pull_requests": the profile contains exactly one builtin.git-delivery.pr@2 node. Zeroshot turns the runs into one linear stack: each run needs exactly the run before it, in dependency order with ties broken by run name. Each run opens a pull request against the previous run's branch, the first against the base branch, and nothing is merged.

In both modes, agent bindings must not declare GH_TOKEN; only the Git delivery binding may.

from datetime import UTC, datetime, timedelta

from zeroshot import Client, HostedTarget, StackRequest, StackRun


async def run_stack() -> None:
    request = StackRequest(
        title="Release checkout update",
        repository="the-open-engine/zeroshot",
        branch="main",
        profile="org:software-change",
        delivery="merge",
        expires_at=(datetime.now(UTC) + timedelta(days=1)).isoformat(),
        runs={
            "backend": StackRun(input={"task": "Update the API."}),
            "frontend": StackRun(input={"task": "Update the client."}),
            "integrate": StackRun(
                input={"task": "Verify the combined changes and run the release tests."},
                needs=("backend", "frontend"),
            ),
        },
        submission_key="checkout-release-1",
    )

    async with Client(target=HostedTarget("platform")) as client:
        stack = await client.submit_stack(request)
        status = await stack.wait(wait_timeout=21_600)

    if not status.succeeded:
        raise RuntimeError(f"stack ended as {status.state}")

With a pull-request delivery profile and delivery="stacked_pull_requests", the same runs become the chain backend, frontend, integrate: three pull requests, each targeting the branch of the one before it.

Stack input is static JSON. A dependency controls when a run may start; it doesn't copy output into another run. Run IDs are assigned once during atomic submission. Once its dependencies are delivered, Platform materializes a run against an exact source branch and revision. When materialization completes, readyAt is set and the run's queue deadline is the earlier of stack expiry and seven days after readyAt. With merge delivery, a merge conflict is repaired by the conflicting run itself in the same checkout and delivery loop. A descendant cannot repair a failed predecessor; it ends as dependency_failed. Stack.watch() polls the aggregate Platform status and emits changed snapshots because the v1 stack API has no streaming endpoint. The stacks guide in the Zeroshot documentation covers delivery modes and reviewing a stacked pull-request chain.

Exact graph and runtime control

Use GraphSpec and RuntimePlan to pass exact JSON values unchanged. Python does not traverse or validate either document:

from collections.abc import Mapping
from typing import Any

from zeroshot import GraphSpec, RunRequest, RuntimePlan


def exact_request(
    graph_document: Mapping[str, Any],
    runtime_document: Mapping[str, Any],
) -> RunRequest:
    return RunRequest(
        title="Repair checkout",
        graph=GraphSpec.from_dict(graph_document),
        initial_input={"ticket": "OE-123"},
        runtime=RuntimePlan.from_dict(runtime_document),
        submission_key="oe-123-attempt-1",
    )

await client.list_presets() and await client.get_preset(...) query the bundled Rust catalog. The Python package contains no copied preset registry, provider/model registry, graph schema, or semantic validator. Every submission runs the executable's preflight before a local controller starts or a direct target is contacted. Local RunRequest values also accept worktree=True and optional worktree_base="local" or "remote". Set them on the request itself; complete requests cannot be combined with string-submission overrides.

Durable observation

Run.watch(after=..., follow=True) keeps watching across suspensions. Run.watch(after=...) and Run.logs(after=..., execution=...) resume strictly after opaque native cursors. A wait_timeout expiry raises RunWaitTimeout carrying the still-active Run; cancelling the Python await also detaches without stopping it. Use Run.force_stop() to terminate it. Each LogEvent.timestamp is the positive, JavaScript-safe Unix epoch millisecond captured at the producer and preserved unchanged by durable replay.

Keep Run.id through answers, resumes, and retries. await run.status() reports part_id and current_part_id. Select one part with client.get_run(run.id, part_id=part_id). Log and status events report the part that produced them. A logical watch follows part changes. Waiting raises RunSuspendedError when the current part suspends. To answer the exact question you displayed, use question = await run.request() and await run.answer(answer, part_id=question.part_id). The returned handle keeps the logical ID and records the new current part.

await run.discard_workspace() uses the client's target and returns whether retained data was deleted. For a finished local run it frees the recovery lineage's checkpoints while preserving the checkout, ledger, logs and delivery recovery state. Run.resume() keeps using the current checkout. Named targets discard their retained workspace as before.

Environment values

With environment=None, submission values come from os.environ. An explicit mapping replaces ambient credential variables; native saved connections and local harness login still apply. Zeroshot selects declared runtime and source-connection fields; transport credentials stay outside agent environments unless independently declared by a node. The executable owns provider defaults.

Packaging and versions

The package is released only as platform wheels because each wheel bundles one matching native executable; there is no first-run download, Node dependency, PyO3 ABI, or auth dependency. The distribution name is the-open-engine-zeroshot, the import package remains zeroshot, and py.typed is included.

An SDK release tag is zeroshot-python-vZEROSHOT_SDK, for example zeroshot-python-v8.0.0_1; its PEP 440 package version is 8.0.0.post1. Revision 1 is released automatically after the corresponding Zeroshot release. Later SDK-only revisions may be released independently against the same immutable Zeroshot release.

Standing direction

steer = await run.steer("Prioritize the parser regression.") records standing direction without continuing a suspended run. Use await run.steer(text, mode="once") to deliver once per node instance; mode="standing" delivers once per provider conversation and remains the default. RunStatus.steers exposes excerpts, message modes, optional network origin metadata and confirmed receiving executions; omitted_steers reports the bounded listing's omissions. Each agent conversation receives a steer at its next tool call or prompt. await run.vector(steer.id) reads its full text, and await run.vectors() includes steer and steer_receipt entries. Direction is limited to 262,144 UTF-8 bytes and is stored as given; do not include secrets. Existing SDK error types report refusals.

File workflows

The async client also delegates stage_file, upload_file, list_files, download_file, remove_file and cleanup to the packaged CLI, returning its JSON receipts. These operations use the client's local, direct or named target and stream bytes outside run JSON. Unsupported targets fail with the existing typed native error; cancellation reaps the CLI child.

RunRequest(workspace=True) selects file work without a Git source. Local placement defaults to in-place; copy_workspace=True freezes a managed copy. workspace_seeds=("user:PATH",) or workspace_placement="managed" selects a managed workspace; named targets are always managed. File inputs and answers use managed copies independently of workspace placement.

RunResult.artifacts contains explicit final publications, including for a null result. (await run.request()).request.artifacts contains authorized request attachments; ordinary status omits them. A managed reference's address.scope.runId identifies the producing part for download_file(path, output, run_id=...). A local reference denotes a live path on the local machine. cleanup(all=True) removes the age filter for eligible publications/checkpoints; it preserves pending work, library files, live local outputs and ledgers.

See the complete example and the file workflow guide for target selection, current-byte capture, lifetimes and CLI equivalents.

Metadata

Release files for the-open-engine-zeroshot 17.4.0.post1

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

Built distributions (wheels)

Table of built distributions (wheels) for the-open-engine-zeroshot 17.4.0.post1
File Actions
the_open_engine_zeroshot-17.4.0.post1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for the_open_engine_zeroshot-17.4.0.post1-py3-none-win_amd64.whl
the_open_engine_zeroshot-17.4.0.post1-py3-none-manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for the_open_engine_zeroshot-17.4.0.post1-py3-none-manylinux_2_17_x86_64.whl
the_open_engine_zeroshot-17.4.0.post1-py3-none-manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for the_open_engine_zeroshot-17.4.0.post1-py3-none-manylinux_2_17_aarch64.whl
the_open_engine_zeroshot-17.4.0.post1-py3-none-macosx_11_0_x86_64.whl Python 3 none macOS 11.0+ x86-64 Details for the_open_engine_zeroshot-17.4.0.post1-py3-none-macosx_11_0_x86_64.whl
the_open_engine_zeroshot-17.4.0.post1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for the_open_engine_zeroshot-17.4.0.post1-py3-none-macosx_11_0_arm64.whl

Total release size: 155.6 MB

Release files / the_open_engine_zeroshot-17.4.0.post1-py3-none-win_amd64.whl

Download URL the_open_engine_zeroshot-17.4.0.post1-py3-none-win_amd64.whl
Size 31.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
c089e2a502f5c18eba56c4b1e6810b98333a38700fa28f96306863a5168afc77
BLAKE2b-256 checksum
How to use checksums
9b7b7b2eb3853321d88642f7dd1f38f2a158dcfa5b9e975d22b37fe6f2ff2f4b
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 30, 2026.

Transparency log

Release files / the_open_engine_zeroshot-17.4.0.post1-py3-none-manylinux_2_17_x86_64.whl

Download URL the_open_engine_zeroshot-17.4.0.post1-py3-none-manylinux_2_17_x86_64.whl
Size 33.0 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
8c7c00881fe70097d0e55563e17e945280b2292ede18a0e1a1c861e198a23f5b
BLAKE2b-256 checksum
How to use checksums
95a58565cee47bc36fb4519cd6a4f701bde34908a8fb5e95a1460d762a412205
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 30, 2026.

Transparency log

Release files / the_open_engine_zeroshot-17.4.0.post1-py3-none-manylinux_2_17_aarch64.whl

Download URL the_open_engine_zeroshot-17.4.0.post1-py3-none-manylinux_2_17_aarch64.whl
Size 31.0 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
a898302600073a9496745b04abc081032a1841f5237f314ae563c2b52a138bdb
BLAKE2b-256 checksum
How to use checksums
a880973202249c57494fc0ae928e6d49b1ce4074e487ac11350ab1f3b12f8f23
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 30, 2026.

Transparency log

Release files / the_open_engine_zeroshot-17.4.0.post1-py3-none-macosx_11_0_x86_64.whl

Download URL the_open_engine_zeroshot-17.4.0.post1-py3-none-macosx_11_0_x86_64.whl
Size 31.2 MB
Tags Python 3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
34db9d0e4ede5f9a87beaacfa2c1a192c7ff03ed2dc8da4052818cdeb65cf59b
BLAKE2b-256 checksum
How to use checksums
cad9738e469f27342c120c3c9b76cb62405e4c75e8958e0d17af4eb3709331b3
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 30, 2026.

Transparency log

Release files / the_open_engine_zeroshot-17.4.0.post1-py3-none-macosx_11_0_arm64.whl

Download URL the_open_engine_zeroshot-17.4.0.post1-py3-none-macosx_11_0_arm64.whl
Size 29.3 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7766c7a60328f36fddd85552710558b02ee2a1e7c6416be43954915328d9dde1
BLAKE2b-256 checksum
How to use checksums
b6c815f8d5a2a29470017077cf763f62a1a16a03bf7f96724c38de0dbac08726
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 30, 2026.

Transparency log

Security for the-open-engine-zeroshot 17.4.0.post1

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

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for the_open_engine_zeroshot-17.4.0.post1-py3-none-win_amd64.whl

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 30, 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.

Release history Release notifications | RSS feed

This release
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