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.2.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.2.0
File Size Uploaded Provenance Actions
pi_codemode_py-1.2.0.tar.gz 17.4 kB Without provenance Details for pi_codemode_py-1.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 33.5 kB

Release files / pi_codemode_py-1.2.0.tar.gz

Download URL pi_codemode_py-1.2.0.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
103e02f38dfb74fd39a4ff82e4b0dc389d02beca9c1f28b97734f142f2c126c2
BLAKE2b-256 checksum
How to use checksums
1c96c0ccf1bf2c9b32fa5e6c7c6655d8358f11d662c98a7ef1eb306793c24b4c
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.2.0-py3-none-any.whl

Download URL pi_codemode_py-1.2.0-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8202b9852108fb782d28ef0d18e47d31e6959cd405d1f9d41054ccfbdfcc853d
BLAKE2b-256 checksum
How to use checksums
ff8a0df0e91f0b56fc783cd663d55c24a31e7cdad23cc28835f5d2ea54532f69
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.2.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.2.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