Repository navigation
v0.1.0
First release of the community Python SDK for Pi.
Run Pi from Python while keeping its models, authentication, tools, extensions, and session storage.
New Features
Sync and async clients
Use PiClient in scripts or AsyncPiClient in asyncio applications, with the same commands and run behavior.
Choosing a client → · Async example →
Streaming and settled results
Stream text as it arrives or wait for the completed result, including session identity and observed token usage.
Streaming → · Streaming example → · Results →
Pi's RPC protocol from Python
Continue sessions, send images, steer a running conversation, switch models, and handle extension dialogs through explicit Python methods.
All 33 RPC commands → · RPC structure →
Added
-
Typed command and event payloads, including preservation of unknown upstream fields and events (#7).
-
Owned subprocess startup and shutdown, bounded queues, and cancellation cleanup (#8, #9, #10).
-
Limits on retained run messages and protection against delayed events being attributed to a later run (#15).
-
Nine runnable examples covering sync/async clients, streaming, sessions, images, steering, cancellation, events, and extension UI (#12).
Install
npm install -g @earendil-works/pi-coding-agent@0.85.1
python -m pip install pi-agent-python-sdk==0.1.0Run pi once to configure your provider and model, then:
from pi_agent import PiClient
with PiClient() as pi:
result = pi.run("Explain the current project without changing files.")
print(result.text)Compatibility
| Requirement | Version |
|---|---|
| Python | 3.11+ |
| Pi protocol baseline | 0.85.1 |
| Node.js for Pi 0.85.1 | 22.19.0+ |
Pi must be installed separately. The SDK has no third-party Python runtime dependencies and communicates with Pi over stdio RPC.
CI covers Linux with Python 3.11–3.14, and macOS/Windows with Python 3.14. See the compatibility policy for the tested scope.
For source-checkout users
Replace the former distribution names pi-coding-agent-client or pi-coding-agent-python-sdk with pi-agent-python-sdk in installation commands. Change Python imports from pi_coding_agent_client to pi_agent (#17, #21).