codex-sdk-python 0.91.0__tar.gz → 0.101.0__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.
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/PKG-INFO +16 -10
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/README.md +15 -9
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/pyproject.toml +1 -1
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/__init__.py +1 -1
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/abort.py +9 -0
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/app_server.py +475 -3
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/codex.py +3 -0
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/config_overrides.py +2 -0
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/exceptions.py +8 -0
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/exec.py +29 -12
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/hooks.py +2 -0
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/integrations/pydantic_ai.py +12 -0
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/integrations/pydantic_ai_model.py +241 -77
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/items.py +49 -1
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/options.py +2 -2
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/telemetry.py +2 -0
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/thread.py +102 -2
- codex_sdk_python-0.101.0/src/codex_sdk/tool_envelope.py +524 -0
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/events.py +0 -0
- {codex_sdk_python-0.91.0 → codex_sdk_python-0.101.0}/src/codex_sdk/integrations/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: codex-sdk-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.101.0
|
|
4
4
|
Summary: Python SDK for the Codex CLI agent with async threads, streaming events, and structured outputs
|
|
5
5
|
Keywords: codex,sdk,python,api,cli,agent,async,streaming
|
|
6
6
|
Author: Vectorfy Co
|
|
@@ -44,7 +44,7 @@ Embed the Codex agent in Python workflows. This SDK wraps the bundled `codex` CL
|
|
|
44
44
|
<td><strong>Lifecycle</strong></td>
|
|
45
45
|
<td>
|
|
46
46
|
<a href="#ci-cd"><img src="https://img.shields.io/badge/CI%2FCD-Active-16a34a?style=flat&logo=githubactions&logoColor=white" alt="CI/CD badge" /></a>
|
|
47
|
-
<img src="https://img.shields.io/badge/Release-0.
|
|
47
|
+
<img src="https://img.shields.io/badge/Release-0.101.0-6b7280?style=flat&logo=pypi&logoColor=white" alt="Release 0.101.0 badge" />
|
|
48
48
|
<a href="#license"><img src="https://img.shields.io/badge/License-Apache--2.0-0f766e?style=flat&logo=apache&logoColor=white" alt="License badge" /></a>
|
|
49
49
|
</td>
|
|
50
50
|
</tr>
|
|
@@ -89,7 +89,7 @@ uv add codex-sdk-python
|
|
|
89
89
|
2. Ensure a `codex` binary is available (required for local runs):
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
|
-
# From the repo source (downloads vendor binaries)
|
|
92
|
+
# From the repo source (downloads vendor binaries from the matching npm release)
|
|
93
93
|
python scripts/setup_binary.py
|
|
94
94
|
```
|
|
95
95
|
|
|
@@ -291,7 +291,7 @@ Important mappings to the Codex CLI:
|
|
|
291
291
|
- `config_overrides` maps to repeated `--config key=value` entries.
|
|
292
292
|
|
|
293
293
|
Note: `skills_enabled` is deprecated in Codex 0.80+ (skills are always enabled).
|
|
294
|
-
Note: Codex
|
|
294
|
+
Note: Codex defaults `agents.max_threads` to 6; `max_threads` must be `>= 1` if set.
|
|
295
295
|
Note: Codex 0.88.0+ ignores `experimental_instructions_file`; use
|
|
296
296
|
`model_instructions_file` instead.
|
|
297
297
|
|
|
@@ -346,12 +346,14 @@ default prompt) for richer UI integrations.
|
|
|
346
346
|
|
|
347
347
|
The SDK also exposes helpers for most app-server endpoints:
|
|
348
348
|
|
|
349
|
-
- Threads: `
|
|
349
|
+
- Threads: `thread_start`, `thread_resume`, `thread_fork`, `thread_list`, `thread_loaded_list`,
|
|
350
|
+
`thread_read`, `thread_archive`, `thread_unarchive`, `thread_name_set`,
|
|
351
|
+
`thread_compact_start`, `thread_rollback`
|
|
350
352
|
- Config: `config_read`, `config_value_write`, `config_batch_write`, `config_requirements_read`
|
|
351
|
-
- Skills: `skills_list`
|
|
353
|
+
- Skills: `skills_list`, `skills_remote_read`, `skills_remote_write`, `skills_config_write`
|
|
352
354
|
- Turns/review: `turn_start`, `turn_interrupt`, `review_start`, `turn_session`
|
|
353
355
|
- Models: `model_list`
|
|
354
|
-
- Collaboration modes: `collaboration_mode_list`
|
|
356
|
+
- Collaboration modes: `collaboration_mode_list` (experimental)
|
|
355
357
|
- One-off commands: `command_exec`
|
|
356
358
|
- MCP auth/status: `mcp_server_oauth_login`, `mcp_server_refresh`, `mcp_server_status_list`
|
|
357
359
|
- Account: `account_login_start`, `account_login_cancel`, `account_logout`,
|
|
@@ -361,7 +363,10 @@ The SDK also exposes helpers for most app-server endpoints:
|
|
|
361
363
|
These map 1:1 to the Codex app-server protocol; see `codex/codex-rs/app-server/README.md`
|
|
362
364
|
for payload shapes and event semantics.
|
|
363
365
|
|
|
364
|
-
|
|
366
|
+
Note: some endpoints and fields are gated behind an experimental capability; set
|
|
367
|
+
`AppServerOptions(experimental_api_enabled=True)` to opt in.
|
|
368
|
+
|
|
369
|
+
`thread_list` supports `archived`, `sort_key`, and `source_kinds` filters, and `config_read` accepts an optional `cwd`
|
|
365
370
|
to compute the effective layered config for a specific working directory.
|
|
366
371
|
|
|
367
372
|
### Observability (OTEL) and notify
|
|
@@ -405,8 +410,9 @@ Supported target triples:
|
|
|
405
410
|
- macOS: `x86_64-apple-darwin`, `aarch64-apple-darwin`
|
|
406
411
|
- Windows: `x86_64-pc-windows-msvc`, `aarch64-pc-windows-msvc`
|
|
407
412
|
|
|
408
|
-
If you are working from source and the vendor directory is missing, run
|
|
409
|
-
|
|
413
|
+
If you are working from source and the vendor directory is missing, run
|
|
414
|
+
`python scripts/setup_binary.py` to fetch and assemble the platform `@openai/codex`
|
|
415
|
+
artifacts into `src/codex_sdk/vendor/`.
|
|
410
416
|
|
|
411
417
|
<a id="auth"></a>
|
|
412
418
|
## 
|
|
@@ -8,7 +8,7 @@ Embed the Codex agent in Python workflows. This SDK wraps the bundled `codex` CL
|
|
|
8
8
|
<td><strong>Lifecycle</strong></td>
|
|
9
9
|
<td>
|
|
10
10
|
<a href="#ci-cd"><img src="https://img.shields.io/badge/CI%2FCD-Active-16a34a?style=flat&logo=githubactions&logoColor=white" alt="CI/CD badge" /></a>
|
|
11
|
-
<img src="https://img.shields.io/badge/Release-0.
|
|
11
|
+
<img src="https://img.shields.io/badge/Release-0.101.0-6b7280?style=flat&logo=pypi&logoColor=white" alt="Release 0.101.0 badge" />
|
|
12
12
|
<a href="#license"><img src="https://img.shields.io/badge/License-Apache--2.0-0f766e?style=flat&logo=apache&logoColor=white" alt="License badge" /></a>
|
|
13
13
|
</td>
|
|
14
14
|
</tr>
|
|
@@ -53,7 +53,7 @@ uv add codex-sdk-python
|
|
|
53
53
|
2. Ensure a `codex` binary is available (required for local runs):
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
# From the repo source (downloads vendor binaries)
|
|
56
|
+
# From the repo source (downloads vendor binaries from the matching npm release)
|
|
57
57
|
python scripts/setup_binary.py
|
|
58
58
|
```
|
|
59
59
|
|
|
@@ -255,7 +255,7 @@ Important mappings to the Codex CLI:
|
|
|
255
255
|
- `config_overrides` maps to repeated `--config key=value` entries.
|
|
256
256
|
|
|
257
257
|
Note: `skills_enabled` is deprecated in Codex 0.80+ (skills are always enabled).
|
|
258
|
-
Note: Codex
|
|
258
|
+
Note: Codex defaults `agents.max_threads` to 6; `max_threads` must be `>= 1` if set.
|
|
259
259
|
Note: Codex 0.88.0+ ignores `experimental_instructions_file`; use
|
|
260
260
|
`model_instructions_file` instead.
|
|
261
261
|
|
|
@@ -310,12 +310,14 @@ default prompt) for richer UI integrations.
|
|
|
310
310
|
|
|
311
311
|
The SDK also exposes helpers for most app-server endpoints:
|
|
312
312
|
|
|
313
|
-
- Threads: `
|
|
313
|
+
- Threads: `thread_start`, `thread_resume`, `thread_fork`, `thread_list`, `thread_loaded_list`,
|
|
314
|
+
`thread_read`, `thread_archive`, `thread_unarchive`, `thread_name_set`,
|
|
315
|
+
`thread_compact_start`, `thread_rollback`
|
|
314
316
|
- Config: `config_read`, `config_value_write`, `config_batch_write`, `config_requirements_read`
|
|
315
|
-
- Skills: `skills_list`
|
|
317
|
+
- Skills: `skills_list`, `skills_remote_read`, `skills_remote_write`, `skills_config_write`
|
|
316
318
|
- Turns/review: `turn_start`, `turn_interrupt`, `review_start`, `turn_session`
|
|
317
319
|
- Models: `model_list`
|
|
318
|
-
- Collaboration modes: `collaboration_mode_list`
|
|
320
|
+
- Collaboration modes: `collaboration_mode_list` (experimental)
|
|
319
321
|
- One-off commands: `command_exec`
|
|
320
322
|
- MCP auth/status: `mcp_server_oauth_login`, `mcp_server_refresh`, `mcp_server_status_list`
|
|
321
323
|
- Account: `account_login_start`, `account_login_cancel`, `account_logout`,
|
|
@@ -325,7 +327,10 @@ The SDK also exposes helpers for most app-server endpoints:
|
|
|
325
327
|
These map 1:1 to the Codex app-server protocol; see `codex/codex-rs/app-server/README.md`
|
|
326
328
|
for payload shapes and event semantics.
|
|
327
329
|
|
|
328
|
-
|
|
330
|
+
Note: some endpoints and fields are gated behind an experimental capability; set
|
|
331
|
+
`AppServerOptions(experimental_api_enabled=True)` to opt in.
|
|
332
|
+
|
|
333
|
+
`thread_list` supports `archived`, `sort_key`, and `source_kinds` filters, and `config_read` accepts an optional `cwd`
|
|
329
334
|
to compute the effective layered config for a specific working directory.
|
|
330
335
|
|
|
331
336
|
### Observability (OTEL) and notify
|
|
@@ -369,8 +374,9 @@ Supported target triples:
|
|
|
369
374
|
- macOS: `x86_64-apple-darwin`, `aarch64-apple-darwin`
|
|
370
375
|
- Windows: `x86_64-pc-windows-msvc`, `aarch64-pc-windows-msvc`
|
|
371
376
|
|
|
372
|
-
If you are working from source and the vendor directory is missing, run
|
|
373
|
-
|
|
377
|
+
If you are working from source and the vendor directory is missing, run
|
|
378
|
+
`python scripts/setup_binary.py` to fetch and assemble the platform `@openai/codex`
|
|
379
|
+
artifacts into `src/codex_sdk/vendor/`.
|
|
374
380
|
|
|
375
381
|
<a id="auth"></a>
|
|
376
382
|
## 
|
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "codex-sdk-python"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.101.0"
|
|
8
8
|
description = "Python SDK for the Codex CLI agent with async threads, streaming events, and structured outputs"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {text = "Apache-2.0"}
|
|
@@ -18,13 +18,16 @@ class AbortSignal:
|
|
|
18
18
|
|
|
19
19
|
@property
|
|
20
20
|
def aborted(self) -> bool:
|
|
21
|
+
"""Return True if the signal has been aborted."""
|
|
21
22
|
return self._event.is_set()
|
|
22
23
|
|
|
23
24
|
@property
|
|
24
25
|
def reason(self) -> Optional[AbortReason]:
|
|
26
|
+
"""Return the abort reason if provided."""
|
|
25
27
|
return self._reason
|
|
26
28
|
|
|
27
29
|
async def wait(self) -> None:
|
|
30
|
+
"""Wait until the signal is aborted."""
|
|
28
31
|
await self._event.wait()
|
|
29
32
|
|
|
30
33
|
|
|
@@ -32,9 +35,15 @@ class AbortController:
|
|
|
32
35
|
"""Controller used to trigger cancellation for an AbortSignal."""
|
|
33
36
|
|
|
34
37
|
def __init__(self) -> None:
|
|
38
|
+
"""Create a controller with a fresh AbortSignal."""
|
|
35
39
|
self._event = asyncio.Event()
|
|
36
40
|
self.signal = AbortSignal(self._event)
|
|
37
41
|
|
|
38
42
|
def abort(self, reason: Optional[AbortReason] = None) -> None:
|
|
43
|
+
"""Abort the signal and optionally attach a reason.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
reason: Optional abort reason to surface to callers.
|
|
47
|
+
"""
|
|
39
48
|
self.signal._reason = reason
|
|
40
49
|
self._event.set()
|