Skip to main content

pi-codemode-py

Programmatic tool orchestration (codemode) and on-demand deferred tool discovery (tool_search) for pi-python (zycode).

Design specification: docs/specs/2026-11-24-code-mode-design.md.

Features

  • codemode tool: Executes async Python orchestration scripts in the shared pi_agent_core.sandbox child process (pi-sandbox-child, protocol v2). Intermediate tool outputs stay inside the sandbox; only explicit text() / image() calls, trailing return values, and <console_output> (print()) return to the LLM context.
  • Runtime permission gating: By default ([codemode] require_approval = true), starting an outer codemode script asks for permission in ask and auto modes just like workflow (users inside a container/VM/trusted setup can set require_approval = false). Every inner await tools.<name>(...) call evaluates its concrete arguments at runtime and passes through AgentHarness.invoke_tool (check_tool_call, tool_result hooks, Auto rules and model classifier, and ACP permission prompts) with origin={"kind": "codemode", ...} and writer-preferring serialization when mutating or under sequential tool policy.
  • tool_search & Deferred Tool Loading: Discovers deferred tools (such as pi-mcp servers) via ALL_TOOLS / search_tools() inside scripts or promotes them directly with tool_search.
  • /codemode command: Toggle or inspect runtime modes (/codemode [status|on|hybrid|only|off]).

Sandbox boundaries

Scripts run in a child process (pi_agent_core.sandbox) with a scrubbed environment, empty temporary working directory, stdlib-only allowlisted imports (_safe_import), PEP 578 audit hook (a speed bump, not a security boundary on its own), and OS-level resource limits (Linux rlimit / PR_SET_NO_NEW_PRIVS where unlink, same-user /proc, and sockets remain open; Windows Job Object ActiveProcessLimit=1 and low integrity without RLIMIT_FSIZE). On macOS the kernel does not enforce RLIMIT_AS or RLIMIT_NPROC (repository decision 2026-10-31). Keep [codemode] require_approval = true (default) or run the agent inside zypi --sandbox, a container, or a VM for untrusted repositories.

Metadata

Release files for pi-codemode-py 1.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 pi-codemode-py 1.1.0
File Size Uploaded Provenance Actions
pi_codemode_py-1.1.0.tar.gz 17.4 kB Without provenance Details for pi_codemode_py-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pi-codemode-py 1.1.0
File Interpreter ABI Platform Actions
pi_codemode_py-1.1.0-py3-none-any.whl Python 3 none any Details for pi_codemode_py-1.1.0-py3-none-any.whl

Total release size: 33.5 kB

Release files / pi_codemode_py-1.1.0.tar.gz

Download URL pi_codemode_py-1.1.0.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
630b4822c29b6fafea12af5b81167371981b2cc8061fb81087650afe097fb39f
BLAKE2b-256 checksum
How to use checksums
04f3692af37f839dba728d337d414228d840fe0c8ae36253077c4e1596b324de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pi_codemode_py-1.1.0-py3-none-any.whl

Download URL pi_codemode_py-1.1.0-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87efb6e5a4b0d42567ebb1697fbde1fcf9f2e8b9fc8ee0c6ac1e225f2a7189e9
BLAKE2b-256 checksum
How to use checksums
f70f9b84275a0e894b44e1f2ad336dd87e81318816504ff5183cfcae7795cd24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for pi-codemode-py 1.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

1.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