pi-agent-python-sdk 0.2.2__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/CHANGELOG.md +30 -0
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/PKG-INFO +46 -29
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/README.md +43 -26
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/pyproject.toml +3 -3
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/src/pi_agent/_launch.py +1 -1
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/src/pi_agent/client.py +2 -1
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/src/pi_agent/types.py +68 -1
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/.gitignore +0 -0
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/LICENSE +0 -0
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/src/pi_agent/__init__.py +0 -0
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/src/pi_agent/_collections.py +0 -0
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/src/pi_agent/_events.py +0 -0
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/src/pi_agent/_observation.py +0 -0
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/src/pi_agent/_runs.py +0 -0
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/src/pi_agent/_transport.py +0 -0
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/src/pi_agent/_usage.py +0 -0
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/src/pi_agent/errors.py +0 -0
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/src/pi_agent/py.typed +0 -0
- {pi_agent_python_sdk-0.2.2 → pi_agent_python_sdk-0.2.4}/src/pi_agent/sync.py +0 -0
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.2.4
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Describe Pi 1.0.0 input dispositions, assistant thinking levels, nested tool
|
|
10
|
+
call records, parent tool-call IDs and model type in the typed wire annotations.
|
|
11
|
+
New fields remain optional where older supported runtimes omit them.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Update the tested Pi runtime from 0.87.0 to 1.0.0, retaining 0.85.1 as the minimum.
|
|
16
|
+
Python `prompt`, `steer` and `follow_up` still return `None`; use `request()`
|
|
17
|
+
for the response envelope and `data.disposition`.
|
|
18
|
+
- Refresh the TypeScript behavior contract and extend parity coverage for
|
|
19
|
+
prompt streaming behavior and Pi 1.0.0 metadata.
|
|
20
|
+
- Update development tools and pinned CI actions.
|
|
21
|
+
|
|
22
|
+
## 0.2.3
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- Describe Pi 0.87.0 context-edit session entries and optional model image input
|
|
27
|
+
limits in the typed wire annotations. Both remain Pi-owned behavior; unknown
|
|
28
|
+
fields continue to pass through unchanged.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- Update the tested Pi runtime to 0.87.0, retaining 0.85.1 as the minimum.
|
|
33
|
+
- Refresh the README's quick start, branding, and demonstration video.
|
|
34
|
+
|
|
5
35
|
## 0.2.2
|
|
6
36
|
|
|
7
37
|
### Changed
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pi-agent-python-sdk
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Typed async and synchronous Python clients for Pi's agent RPC runtime
|
|
5
5
|
Project-URL: Homepage, https://github.com/cheenulabs/pi-agent-python-sdk
|
|
6
|
-
Project-URL: Documentation, https://github.com/cheenulabs/pi-agent-python-sdk/tree/v0.2.
|
|
6
|
+
Project-URL: Documentation, https://github.com/cheenulabs/pi-agent-python-sdk/tree/v0.2.4/docs
|
|
7
7
|
Project-URL: Issues, https://github.com/cheenulabs/pi-agent-python-sdk/issues
|
|
8
|
-
Project-URL: Changelog, https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
8
|
+
Project-URL: Changelog, https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/CHANGELOG.md
|
|
9
9
|
Author: cheenulabs
|
|
10
10
|
License-Expression: MIT
|
|
11
11
|
License-File: LICENSE
|
|
@@ -23,17 +23,28 @@ Description-Content-Type: text/markdown
|
|
|
23
23
|
|
|
24
24
|
# Pi Agent Python SDK
|
|
25
25
|
|
|
26
|
+
<p align="center">
|
|
27
|
+
<strong>Your terminal agent. Your Python API.</strong>
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
<a href="https://github.com/cheenulabs/pi-agent-python-sdk">
|
|
32
|
+
<img alt="Pi Agent Python SDK" src="https://raw.githubusercontent.com/cheenulabs/pi-agent-python-sdk/v0.2.4/docs/logo.svg" width="160">
|
|
33
|
+
</a>
|
|
34
|
+
</p>
|
|
35
|
+
|
|
26
36
|
[][pypi]
|
|
27
37
|
[][metadata]
|
|
28
38
|
[][license]
|
|
29
39
|
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
[Pi](https://github.com/earendil-works/pi) is the coding agent that runs in your
|
|
41
|
+
terminal. This unofficial community SDK puts *your* Pi behind a typed sync and
|
|
42
|
+
async Python API — run prompts, stream events, and keep sessions going without
|
|
43
|
+
leaving Python.
|
|
32
44
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
synchronous and asynchronous Python APIs.
|
|
45
|
+
<!-- Inline player: GitHub only auto-embeds bare user-attachments URLs
|
|
46
|
+
(repo-relative / raw / release URLs are stripped or become download links). -->
|
|
47
|
+
https://github.com/user-attachments/assets/c64dde3a-e812-42d4-a005-aa60df861e92
|
|
37
48
|
|
|
38
49
|
```python
|
|
39
50
|
from pi_agent import PiClient
|
|
@@ -48,6 +59,7 @@ Requires an installed, configured Pi CLI — see [Prerequisites](#prerequisites)
|
|
|
48
59
|
[Streaming](#streaming) · [Async](#async-usage) ·
|
|
49
60
|
[Configuration](#configuration) · [Thinking](#models-and-thinking) ·
|
|
50
61
|
[RPC](#rpc-access) · [Documentation](#documentation) ·
|
|
62
|
+
[Further reading](#further-reading) ·
|
|
51
63
|
[Troubleshooting](#troubleshooting) · [Support](#support)
|
|
52
64
|
|
|
53
65
|
## What you can do
|
|
@@ -66,8 +78,8 @@ Requires an installed, configured Pi CLI — see [Prerequisites](#prerequisites)
|
|
|
66
78
|
| Requirement | Notes |
|
|
67
79
|
| --- | --- |
|
|
68
80
|
| Python **3.11+** | Package metadata requires 3.11 or newer |
|
|
69
|
-
| Node.js **22.19.0+** | Required by Pi 0.
|
|
70
|
-
| Pi **0.85.1+** | Minimum accepted version; **0.
|
|
81
|
+
| Node.js **22.19.0+** | Required by Pi 1.0.0 |
|
|
82
|
+
| Pi **0.85.1+** | Minimum accepted version; **1.0.0** is the tested baseline |
|
|
71
83
|
| Model provider | Required; configure with the Pi CLI (see Quick start) |
|
|
72
84
|
|
|
73
85
|
## Quick start
|
|
@@ -75,7 +87,7 @@ Requires an installed, configured Pi CLI — see [Prerequisites](#prerequisites)
|
|
|
75
87
|
Install Pi with Node.js **22.19.0 or newer** (pin matches the tested baseline):
|
|
76
88
|
|
|
77
89
|
```sh
|
|
78
|
-
npm install -g @earendil-works/pi-coding-agent@0.
|
|
90
|
+
npm install -g @earendil-works/pi-coding-agent@1.0.0
|
|
79
91
|
pi --version
|
|
80
92
|
```
|
|
81
93
|
|
|
@@ -304,18 +316,23 @@ the [command reference][commands] for every method.
|
|
|
304
316
|
| [RPC structure][rpc] | How the Python client maps to Pi's protocol |
|
|
305
317
|
| [Compatibility][compatibility] | Runtime versions and platform validation |
|
|
306
318
|
| [Examples][examples] | Runnable sync, async, streaming, sessions, steering, and UI examples |
|
|
307
|
-
| [Release notes][release] | Changes included in 0.2.
|
|
319
|
+
| [Release notes][release] | Changes included in 0.2.4 |
|
|
308
320
|
|
|
309
321
|
Examples use your configured Pi and may make provider calls. Development checks
|
|
310
322
|
use an isolated local test provider; see [CONTRIBUTING.md][contributing] for
|
|
311
323
|
setup and validation commands.
|
|
312
324
|
|
|
325
|
+
## Further reading
|
|
326
|
+
|
|
327
|
+
- [Pi Unchained](https://hasc.substack.com/p/pi-unchained) — why this SDK exists
|
|
328
|
+
and how Pi fits into Python workflows.
|
|
329
|
+
|
|
313
330
|
## Troubleshooting
|
|
314
331
|
|
|
315
332
|
| Symptom | What to check |
|
|
316
333
|
| --- | --- |
|
|
317
334
|
| `pi` not found / launch fails | Ensure the Pi CLI is on `PATH`, or pass `executable=` to the client |
|
|
318
|
-
| Version rejected | Upgrade to Pi **0.85.1+**; prefer the tested baseline **0.
|
|
335
|
+
| Version rejected | Upgrade to Pi **0.85.1+**; prefer the tested baseline **1.0.0** |
|
|
319
336
|
| No model / auth errors | Run `pi` once and complete provider setup |
|
|
320
337
|
| Unexpected file or command changes | Review Pi tool/extension settings before automation |
|
|
321
338
|
|
|
@@ -330,20 +347,20 @@ setup and validation commands.
|
|
|
330
347
|
[MIT][license]
|
|
331
348
|
|
|
332
349
|
[pypi]: https://pypi.org/project/pi-agent-python-sdk/
|
|
333
|
-
[release]: https://github.com/cheenulabs/pi-agent-python-sdk/releases/tag/v0.2.
|
|
334
|
-
[metadata]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
335
|
-
[license]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
336
|
-
[compatibility]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
337
|
-
[errors]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
338
|
-
[stream-example]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
339
|
-
[constructor-options]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
340
|
-
[extensions]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
341
|
-
[ui-example]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
342
|
-
[rpc]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
343
|
-
[commands]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
344
|
-
[usage]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
345
|
-
[api]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
346
|
-
[examples]: https://github.com/cheenulabs/pi-agent-python-sdk/tree/v0.2.
|
|
347
|
-
[contributing]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
350
|
+
[release]: https://github.com/cheenulabs/pi-agent-python-sdk/releases/tag/v0.2.4
|
|
351
|
+
[metadata]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/pyproject.toml
|
|
352
|
+
[license]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/LICENSE
|
|
353
|
+
[compatibility]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/compatibility.md
|
|
354
|
+
[errors]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/errors.md
|
|
355
|
+
[stream-example]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/examples/stream.py
|
|
356
|
+
[constructor-options]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/api.md#constructor-options
|
|
357
|
+
[extensions]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/usage.md#using-your-own-extensions
|
|
358
|
+
[ui-example]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/examples/ui.py
|
|
359
|
+
[rpc]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/rpc.md
|
|
360
|
+
[commands]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/api.md#all-33-rpc-commands
|
|
361
|
+
[usage]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/usage.md
|
|
362
|
+
[api]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/api.md
|
|
363
|
+
[examples]: https://github.com/cheenulabs/pi-agent-python-sdk/tree/v0.2.4/examples
|
|
364
|
+
[contributing]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/CONTRIBUTING.md
|
|
348
365
|
[issues]: https://github.com/cheenulabs/pi-agent-python-sdk/issues
|
|
349
366
|
[security]: https://github.com/cheenulabs/pi-agent-python-sdk/security/advisories/new
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
# Pi Agent Python SDK
|
|
2
2
|
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Your terminal agent. Your Python API.</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://github.com/cheenulabs/pi-agent-python-sdk">
|
|
9
|
+
<img alt="Pi Agent Python SDK" src="https://raw.githubusercontent.com/cheenulabs/pi-agent-python-sdk/v0.2.4/docs/logo.svg" width="160">
|
|
10
|
+
</a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
3
13
|
[][pypi]
|
|
4
14
|
[][metadata]
|
|
5
15
|
[][license]
|
|
6
16
|
|
|
7
|
-
|
|
8
|
-
|
|
17
|
+
[Pi](https://github.com/earendil-works/pi) is the coding agent that runs in your
|
|
18
|
+
terminal. This unofficial community SDK puts *your* Pi behind a typed sync and
|
|
19
|
+
async Python API — run prompts, stream events, and keep sessions going without
|
|
20
|
+
leaving Python.
|
|
9
21
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
synchronous and asynchronous Python APIs.
|
|
22
|
+
<!-- Inline player: GitHub only auto-embeds bare user-attachments URLs
|
|
23
|
+
(repo-relative / raw / release URLs are stripped or become download links). -->
|
|
24
|
+
https://github.com/user-attachments/assets/c64dde3a-e812-42d4-a005-aa60df861e92
|
|
14
25
|
|
|
15
26
|
```python
|
|
16
27
|
from pi_agent import PiClient
|
|
@@ -25,6 +36,7 @@ Requires an installed, configured Pi CLI — see [Prerequisites](#prerequisites)
|
|
|
25
36
|
[Streaming](#streaming) · [Async](#async-usage) ·
|
|
26
37
|
[Configuration](#configuration) · [Thinking](#models-and-thinking) ·
|
|
27
38
|
[RPC](#rpc-access) · [Documentation](#documentation) ·
|
|
39
|
+
[Further reading](#further-reading) ·
|
|
28
40
|
[Troubleshooting](#troubleshooting) · [Support](#support)
|
|
29
41
|
|
|
30
42
|
## What you can do
|
|
@@ -43,8 +55,8 @@ Requires an installed, configured Pi CLI — see [Prerequisites](#prerequisites)
|
|
|
43
55
|
| Requirement | Notes |
|
|
44
56
|
| --- | --- |
|
|
45
57
|
| Python **3.11+** | Package metadata requires 3.11 or newer |
|
|
46
|
-
| Node.js **22.19.0+** | Required by Pi 0.
|
|
47
|
-
| Pi **0.85.1+** | Minimum accepted version; **0.
|
|
58
|
+
| Node.js **22.19.0+** | Required by Pi 1.0.0 |
|
|
59
|
+
| Pi **0.85.1+** | Minimum accepted version; **1.0.0** is the tested baseline |
|
|
48
60
|
| Model provider | Required; configure with the Pi CLI (see Quick start) |
|
|
49
61
|
|
|
50
62
|
## Quick start
|
|
@@ -52,7 +64,7 @@ Requires an installed, configured Pi CLI — see [Prerequisites](#prerequisites)
|
|
|
52
64
|
Install Pi with Node.js **22.19.0 or newer** (pin matches the tested baseline):
|
|
53
65
|
|
|
54
66
|
```sh
|
|
55
|
-
npm install -g @earendil-works/pi-coding-agent@0.
|
|
67
|
+
npm install -g @earendil-works/pi-coding-agent@1.0.0
|
|
56
68
|
pi --version
|
|
57
69
|
```
|
|
58
70
|
|
|
@@ -281,18 +293,23 @@ the [command reference][commands] for every method.
|
|
|
281
293
|
| [RPC structure][rpc] | How the Python client maps to Pi's protocol |
|
|
282
294
|
| [Compatibility][compatibility] | Runtime versions and platform validation |
|
|
283
295
|
| [Examples][examples] | Runnable sync, async, streaming, sessions, steering, and UI examples |
|
|
284
|
-
| [Release notes][release] | Changes included in 0.2.
|
|
296
|
+
| [Release notes][release] | Changes included in 0.2.4 |
|
|
285
297
|
|
|
286
298
|
Examples use your configured Pi and may make provider calls. Development checks
|
|
287
299
|
use an isolated local test provider; see [CONTRIBUTING.md][contributing] for
|
|
288
300
|
setup and validation commands.
|
|
289
301
|
|
|
302
|
+
## Further reading
|
|
303
|
+
|
|
304
|
+
- [Pi Unchained](https://hasc.substack.com/p/pi-unchained) — why this SDK exists
|
|
305
|
+
and how Pi fits into Python workflows.
|
|
306
|
+
|
|
290
307
|
## Troubleshooting
|
|
291
308
|
|
|
292
309
|
| Symptom | What to check |
|
|
293
310
|
| --- | --- |
|
|
294
311
|
| `pi` not found / launch fails | Ensure the Pi CLI is on `PATH`, or pass `executable=` to the client |
|
|
295
|
-
| Version rejected | Upgrade to Pi **0.85.1+**; prefer the tested baseline **0.
|
|
312
|
+
| Version rejected | Upgrade to Pi **0.85.1+**; prefer the tested baseline **1.0.0** |
|
|
296
313
|
| No model / auth errors | Run `pi` once and complete provider setup |
|
|
297
314
|
| Unexpected file or command changes | Review Pi tool/extension settings before automation |
|
|
298
315
|
|
|
@@ -307,20 +324,20 @@ setup and validation commands.
|
|
|
307
324
|
[MIT][license]
|
|
308
325
|
|
|
309
326
|
[pypi]: https://pypi.org/project/pi-agent-python-sdk/
|
|
310
|
-
[release]: https://github.com/cheenulabs/pi-agent-python-sdk/releases/tag/v0.2.
|
|
311
|
-
[metadata]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
312
|
-
[license]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
313
|
-
[compatibility]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
314
|
-
[errors]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
315
|
-
[stream-example]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
316
|
-
[constructor-options]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
317
|
-
[extensions]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
318
|
-
[ui-example]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
319
|
-
[rpc]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
320
|
-
[commands]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
321
|
-
[usage]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
322
|
-
[api]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
323
|
-
[examples]: https://github.com/cheenulabs/pi-agent-python-sdk/tree/v0.2.
|
|
324
|
-
[contributing]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
327
|
+
[release]: https://github.com/cheenulabs/pi-agent-python-sdk/releases/tag/v0.2.4
|
|
328
|
+
[metadata]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/pyproject.toml
|
|
329
|
+
[license]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/LICENSE
|
|
330
|
+
[compatibility]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/compatibility.md
|
|
331
|
+
[errors]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/errors.md
|
|
332
|
+
[stream-example]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/examples/stream.py
|
|
333
|
+
[constructor-options]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/api.md#constructor-options
|
|
334
|
+
[extensions]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/usage.md#using-your-own-extensions
|
|
335
|
+
[ui-example]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/examples/ui.py
|
|
336
|
+
[rpc]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/rpc.md
|
|
337
|
+
[commands]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/api.md#all-33-rpc-commands
|
|
338
|
+
[usage]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/usage.md
|
|
339
|
+
[api]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/docs/api.md
|
|
340
|
+
[examples]: https://github.com/cheenulabs/pi-agent-python-sdk/tree/v0.2.4/examples
|
|
341
|
+
[contributing]: https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/CONTRIBUTING.md
|
|
325
342
|
[issues]: https://github.com/cheenulabs/pi-agent-python-sdk/issues
|
|
326
343
|
[security]: https://github.com/cheenulabs/pi-agent-python-sdk/security/advisories/new
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pi-agent-python-sdk"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.4"
|
|
8
8
|
description = "Typed async and synchronous Python clients for Pi's agent RPC runtime"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -26,9 +26,9 @@ dependencies = []
|
|
|
26
26
|
|
|
27
27
|
[project.urls]
|
|
28
28
|
Homepage = "https://github.com/cheenulabs/pi-agent-python-sdk"
|
|
29
|
-
Documentation = "https://github.com/cheenulabs/pi-agent-python-sdk/tree/v0.2.
|
|
29
|
+
Documentation = "https://github.com/cheenulabs/pi-agent-python-sdk/tree/v0.2.4/docs"
|
|
30
30
|
Issues = "https://github.com/cheenulabs/pi-agent-python-sdk/issues"
|
|
31
|
-
Changelog = "https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.
|
|
31
|
+
Changelog = "https://github.com/cheenulabs/pi-agent-python-sdk/blob/v0.2.4/CHANGELOG.md"
|
|
32
32
|
|
|
33
33
|
[dependency-groups]
|
|
34
34
|
dev = [
|
|
@@ -13,7 +13,7 @@ from ._transport import _close_process_pipes, _wait_for_exit
|
|
|
13
13
|
from .errors import PiProcessError, PiVersionError
|
|
14
14
|
|
|
15
15
|
MINIMUM_PI_VERSION = "0.85.1"
|
|
16
|
-
TESTED_PI_VERSION = "0.
|
|
16
|
+
TESTED_PI_VERSION = "1.0.0"
|
|
17
17
|
|
|
18
18
|
# The client owns these options. In particular --print consumes an initial prompt.
|
|
19
19
|
_RESERVED = {
|
|
@@ -759,7 +759,8 @@ class AsyncPiClient:
|
|
|
759
759
|
) -> None:
|
|
760
760
|
"""Return None after checked acceptance; handled commands may never start a run.
|
|
761
761
|
|
|
762
|
-
Raises PiCommandError on rejection. Use request() for the raw envelope
|
|
762
|
+
Raises PiCommandError on rejection. Use request() for the raw envelope,
|
|
763
|
+
including data.disposition when Pi provides it.
|
|
763
764
|
"""
|
|
764
765
|
fields: dict[str, Any] = {"message": message}
|
|
765
766
|
if images is not None:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Pi 0.
|
|
1
|
+
"""Pi 1.0.0 wire annotations and small Python conveniences.
|
|
2
2
|
|
|
3
3
|
Wire fields retain Pi's spelling and remain ordinary dictionaries. These
|
|
4
4
|
annotations describe known shapes, not a recursive runtime validator: extensions
|
|
@@ -20,6 +20,8 @@ RawRecord: TypeAlias = dict[str, Any]
|
|
|
20
20
|
ThinkingLevel: TypeAlias = Literal["off", "minimal", "low", "medium", "high", "xhigh", "max"]
|
|
21
21
|
QueueMode: TypeAlias = Literal["all", "one-at-a-time"]
|
|
22
22
|
StreamingBehavior: TypeAlias = Literal["steer", "followUp"]
|
|
23
|
+
QueuedInputDisposition: TypeAlias = Literal["handled", "queued"]
|
|
24
|
+
PromptDisposition: TypeAlias = Literal["handled", "queued", "started"]
|
|
23
25
|
CompactionReason: TypeAlias = Literal["manual", "threshold", "overflow"]
|
|
24
26
|
StopReason: TypeAlias = Literal[
|
|
25
27
|
"pending", "stop", "length", "toolUse", "error", "aborted", "deferred"
|
|
@@ -131,6 +133,7 @@ class AssistantMessage(TypedDict):
|
|
|
131
133
|
model: str
|
|
132
134
|
responseModel: NotRequired[str]
|
|
133
135
|
responseId: NotRequired[str]
|
|
136
|
+
thinkingLevel: NotRequired[ThinkingLevel]
|
|
134
137
|
providerThinkingLevel: NotRequired[str]
|
|
135
138
|
diagnostics: NotRequired[list[AssistantMessageDiagnostic]]
|
|
136
139
|
usage: Usage
|
|
@@ -142,6 +145,21 @@ class AssistantMessage(TypedDict):
|
|
|
142
145
|
timestamp: float
|
|
143
146
|
|
|
144
147
|
|
|
148
|
+
class NestedToolCallRecord(TypedDict):
|
|
149
|
+
id: str
|
|
150
|
+
name: str
|
|
151
|
+
arguments: NotRequired[JSONObject]
|
|
152
|
+
argumentsBytes: NotRequired[float]
|
|
153
|
+
status: Literal["ok", "error", "unfinished"]
|
|
154
|
+
durationMs: NotRequired[float]
|
|
155
|
+
error: NotRequired[str]
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class NestedToolCalls(TypedDict):
|
|
159
|
+
calls: list[NestedToolCallRecord]
|
|
160
|
+
complete: bool
|
|
161
|
+
|
|
162
|
+
|
|
145
163
|
class ToolResultMessage(TypedDict):
|
|
146
164
|
role: Literal["toolResult"]
|
|
147
165
|
toolCallId: str
|
|
@@ -149,6 +167,7 @@ class ToolResultMessage(TypedDict):
|
|
|
149
167
|
content: list[TextContent | ImageContent]
|
|
150
168
|
details: NotRequired[JSONValue]
|
|
151
169
|
usage: NotRequired[Usage]
|
|
170
|
+
nestedCalls: NotRequired[NestedToolCalls]
|
|
152
171
|
addedToolNames: NotRequired[list[str]] # Legacy Pi 0.85.1 field.
|
|
153
172
|
isError: bool
|
|
154
173
|
timestamp: float
|
|
@@ -221,7 +240,26 @@ class ModelPromptCache(TypedDict, total=False):
|
|
|
221
240
|
long: float
|
|
222
241
|
|
|
223
242
|
|
|
243
|
+
class ModelImageResizeOptions(TypedDict, total=False):
|
|
244
|
+
maxWidth: float
|
|
245
|
+
maxHeight: float
|
|
246
|
+
maxBytes: float
|
|
247
|
+
jpegQuality: float
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
class ModelImageInputLimits(TypedDict, total=False):
|
|
251
|
+
resize: ModelImageResizeOptions
|
|
252
|
+
maxPerMessage: float
|
|
253
|
+
maxPerRequest: float
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
class ModelInputLimits(TypedDict, total=False):
|
|
257
|
+
maxRequestBytes: float
|
|
258
|
+
images: ModelImageInputLimits
|
|
259
|
+
|
|
260
|
+
|
|
224
261
|
class Model(TypedDict):
|
|
262
|
+
type: NotRequired[Literal["chat"]]
|
|
225
263
|
id: str
|
|
226
264
|
name: str
|
|
227
265
|
api: str
|
|
@@ -230,6 +268,7 @@ class Model(TypedDict):
|
|
|
230
268
|
reasoning: bool
|
|
231
269
|
thinkingLevelMap: NotRequired[dict[ThinkingLevel, str | None]]
|
|
232
270
|
input: list[Literal["text", "image"]]
|
|
271
|
+
inputLimits: NotRequired[ModelInputLimits]
|
|
233
272
|
cost: ModelCost
|
|
234
273
|
contextWindow: float
|
|
235
274
|
maxTokens: float
|
|
@@ -378,6 +417,22 @@ class CustomMessageEntry(_EntryBase):
|
|
|
378
417
|
display: bool
|
|
379
418
|
|
|
380
419
|
|
|
420
|
+
# Keep the list arms separate so typing rejects mixed ToolCall and ImageContent lists.
|
|
421
|
+
ContextEditableContent: TypeAlias = (
|
|
422
|
+
str | list[TextContent | ImageContent] | list[TextContent | ThinkingContent | ToolCall]
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
class ContextEditReplacement(TypedDict):
|
|
427
|
+
content: ContextEditableContent
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
class ContextEditEntry(_EntryBase):
|
|
431
|
+
type: Literal["context_edit"]
|
|
432
|
+
targetId: str
|
|
433
|
+
replacement: ContextEditReplacement | None
|
|
434
|
+
|
|
435
|
+
|
|
381
436
|
class LabelEntry(_EntryBase):
|
|
382
437
|
type: Literal["label"]
|
|
383
438
|
targetId: str
|
|
@@ -398,6 +453,7 @@ SessionEntry: TypeAlias = (
|
|
|
398
453
|
| BranchSummaryEntry
|
|
399
454
|
| CustomEntry
|
|
400
455
|
| CustomMessageEntry
|
|
456
|
+
| ContextEditEntry
|
|
401
457
|
| LabelEntry
|
|
402
458
|
| SessionInfoEntry
|
|
403
459
|
)
|
|
@@ -415,6 +471,14 @@ class QueueState(TypedDict):
|
|
|
415
471
|
followUp: list[str]
|
|
416
472
|
|
|
417
473
|
|
|
474
|
+
class PromptDispositionData(TypedDict):
|
|
475
|
+
disposition: PromptDisposition
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
class QueuedInputDispositionData(TypedDict):
|
|
479
|
+
disposition: QueuedInputDisposition
|
|
480
|
+
|
|
481
|
+
|
|
418
482
|
class SessionChangeResult(TypedDict):
|
|
419
483
|
cancelled: bool
|
|
420
484
|
|
|
@@ -685,6 +749,7 @@ class ToolExecutionStartEvent(TypedDict):
|
|
|
685
749
|
toolCallId: str
|
|
686
750
|
toolName: str
|
|
687
751
|
args: JSONValue
|
|
752
|
+
parentToolCallId: NotRequired[str]
|
|
688
753
|
|
|
689
754
|
|
|
690
755
|
class ToolExecutionUpdateEvent(TypedDict):
|
|
@@ -693,6 +758,7 @@ class ToolExecutionUpdateEvent(TypedDict):
|
|
|
693
758
|
toolName: str
|
|
694
759
|
args: JSONValue
|
|
695
760
|
partialResult: JSONValue
|
|
761
|
+
parentToolCallId: NotRequired[str]
|
|
696
762
|
|
|
697
763
|
|
|
698
764
|
class ToolExecutionEndEvent(TypedDict):
|
|
@@ -701,6 +767,7 @@ class ToolExecutionEndEvent(TypedDict):
|
|
|
701
767
|
toolName: str
|
|
702
768
|
result: JSONValue
|
|
703
769
|
isError: bool
|
|
770
|
+
parentToolCallId: NotRequired[str]
|
|
704
771
|
|
|
705
772
|
|
|
706
773
|
class QueueUpdateEvent(QueueState):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|