Skip to content

v0.4.0

Latest

Choose a tag to compare

@has-c has-c released this 20 Nov 22:38
e3907e6

Run Pi unattended from Python, configure it in code, and test without a model: new opt-in helpers for the community Python SDK.

python -m pip install --upgrade pi-agent-python-sdk==0.4.0

Run unattended

headless_args() returns startup options that load only what you name. It turns off discovery of extensions, skills, prompt templates, themes, AGENTS.md/CLAUDE.md, project-local files, SYSTEM.md/APPEND_SYSTEM.md, MCP and startup network work. RunResult.raise_for_incomplete() raises PiIncompleteRunError when a run stopped for a reason other than stop or produced no text, and keeps the partial result (#137).

from pi_agent import headless_args
from pi_agent.coding import PiClient

with PiClient(no_session=True, extra_args=headless_args(tools=["read", "grep"])) as pi:
    print(pi.run("Summarise data.csv.").raise_for_incomplete().text)

Unattended runs →

Configure Pi from code

AgentConfig writes the models, settings and credentials you pass to a private temporary agent directory, and gives you the env that points a client at it. Runs no longer depend on whatever is configured in ~/.pi/agent, and the folder is removed on exit (#142).

Configure Pi from code →

Test without a model

pi_agent.testing.FakePi is a scripted fake Pi that the real clients launch as a subprocess. Tests exercise the SDK's actual run, streaming, result and error handling without a model, credentials, Node.js or network access, and can check the prompts that were sent (#139).

Testing guide →

Fixed

An inbound record exactly at max_record_bytes is accepted when its CRLF ending arrives in two chunks, instead of closing the client (#143).

Extension UI dialogs with timeout: 0 no longer get an immediate local deadline; zero means no timer, as in Pi. Negative, non-finite and boolean values are also ignored (#145).

The oversized-prompt error now names Limits.max_record_bytes and explains that the limit also covers Pi's echoed prompt. Behaviour is unchanged (#144).

Compatibility

All new helpers are opt-in: client defaults, the RPC protocol and existing imports are unchanged. The tested coding-agent baseline advances from Pi 1.5.2 to 1.6.0; the minimum remains 0.85.1. Users of strict_version=True must install Pi 1.6.0 separately. headless_args() disables MCP with --no-mcp, which Pi before 1.3.0 rejects; pass mcp=True there.

Requirement Version
Python 3.11+
Coding-agent baseline (tested) 1.6.0
Coding-agent minimum 0.85.1
Node.js for the tested runtimes 22.19.0+
Experimental Durable baseline 1.5.2, caller-supplied host
npm install -g @earendil-works/pi-coding-agent@1.6.0

Pi owns provider authentication, models, tools and sessions. Installing this SDK does not install or upgrade Pi.

Compatibility policy · Changelog