codex-sdk-python 0.89.0__tar.gz → 0.98.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.89.0 → codex_sdk_python-0.98.0}/PKG-INFO +16 -8
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/README.md +14 -6
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/pyproject.toml +5 -2
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/__init__.py +11 -1
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/abort.py +9 -0
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/app_server.py +273 -3
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/codex.py +3 -0
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/config_overrides.py +2 -0
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/exceptions.py +8 -0
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/exec.py +36 -9
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/hooks.py +2 -0
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/integrations/pydantic_ai.py +12 -0
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/integrations/pydantic_ai_model.py +169 -46
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/items.py +49 -1
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/options.py +7 -2
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/telemetry.py +2 -0
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/thread.py +103 -2
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.0}/src/codex_sdk/events.py +0 -0
- {codex_sdk_python-0.89.0 → codex_sdk_python-0.98.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.98.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
|
|
@@ -18,7 +18,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
19
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
20
|
Classifier: Topic :: Software Development :: Build Tools
|
|
21
|
-
Requires-Dist: logfire ; extra == 'logfire'
|
|
21
|
+
Requires-Dist: logfire-api>=4 ; extra == 'logfire'
|
|
22
22
|
Requires-Dist: pydantic>=2 ; extra == 'pydantic'
|
|
23
23
|
Requires-Dist: pydantic-ai ; python_full_version >= '3.10' and extra == 'pydantic-ai'
|
|
24
24
|
Maintainer: 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.98.0-6b7280?style=flat&logo=pypi&logoColor=white" alt="Release 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
|
|
|
@@ -255,6 +255,7 @@ ThreadOptions(
|
|
|
255
255
|
exec_policy_enabled=True,
|
|
256
256
|
remote_models_enabled=False,
|
|
257
257
|
collaboration_modes_enabled=True,
|
|
258
|
+
connectors_enabled=True,
|
|
258
259
|
responses_websockets_enabled=True,
|
|
259
260
|
request_compression_enabled=True,
|
|
260
261
|
approval_policy="on-request",
|
|
@@ -282,6 +283,7 @@ Important mappings to the Codex CLI:
|
|
|
282
283
|
- `exec_policy_enabled` maps to `--config features.exec_policy=...`.
|
|
283
284
|
- `remote_models_enabled` maps to `--config features.remote_models=...`.
|
|
284
285
|
- `collaboration_modes_enabled` maps to `--config features.collaboration_modes=...`.
|
|
286
|
+
- `connectors_enabled` maps to `--config features.connectors=...`.
|
|
285
287
|
- `responses_websockets_enabled` maps to `--config features.responses_websockets=...`.
|
|
286
288
|
- `request_compression_enabled` maps to `--config features.enable_request_compression=...`.
|
|
287
289
|
- `feature_overrides` maps to `--config features.<key>=...` (explicit options take precedence).
|
|
@@ -289,6 +291,7 @@ Important mappings to the Codex CLI:
|
|
|
289
291
|
- `config_overrides` maps to repeated `--config key=value` entries.
|
|
290
292
|
|
|
291
293
|
Note: `skills_enabled` is deprecated in Codex 0.80+ (skills are always enabled).
|
|
294
|
+
Note: Codex defaults `agents.max_threads` to 6; `max_threads` must be `>= 1` if set.
|
|
292
295
|
Note: Codex 0.88.0+ ignores `experimental_instructions_file`; use
|
|
293
296
|
`model_instructions_file` instead.
|
|
294
297
|
|
|
@@ -343,12 +346,14 @@ default prompt) for richer UI integrations.
|
|
|
343
346
|
|
|
344
347
|
The SDK also exposes helpers for most app-server endpoints:
|
|
345
348
|
|
|
346
|
-
- 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`
|
|
347
352
|
- Config: `config_read`, `config_value_write`, `config_batch_write`, `config_requirements_read`
|
|
348
|
-
- Skills: `skills_list`
|
|
353
|
+
- Skills: `skills_list`, `skills_remote_read`, `skills_remote_write`, `skills_config_write`
|
|
349
354
|
- Turns/review: `turn_start`, `turn_interrupt`, `review_start`, `turn_session`
|
|
350
355
|
- Models: `model_list`
|
|
351
|
-
- Collaboration modes: `collaboration_mode_list`
|
|
356
|
+
- Collaboration modes: `collaboration_mode_list` (experimental)
|
|
352
357
|
- One-off commands: `command_exec`
|
|
353
358
|
- MCP auth/status: `mcp_server_oauth_login`, `mcp_server_refresh`, `mcp_server_status_list`
|
|
354
359
|
- Account: `account_login_start`, `account_login_cancel`, `account_logout`,
|
|
@@ -358,7 +363,10 @@ The SDK also exposes helpers for most app-server endpoints:
|
|
|
358
363
|
These map 1:1 to the Codex app-server protocol; see `codex/codex-rs/app-server/README.md`
|
|
359
364
|
for payload shapes and event semantics.
|
|
360
365
|
|
|
361
|
-
|
|
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`
|
|
362
370
|
to compute the effective layered config for a specific working directory.
|
|
363
371
|
|
|
364
372
|
### Observability (OTEL) and notify
|
|
@@ -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.98.0-6b7280?style=flat&logo=pypi&logoColor=white" alt="Release 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
|
|
|
@@ -219,6 +219,7 @@ ThreadOptions(
|
|
|
219
219
|
exec_policy_enabled=True,
|
|
220
220
|
remote_models_enabled=False,
|
|
221
221
|
collaboration_modes_enabled=True,
|
|
222
|
+
connectors_enabled=True,
|
|
222
223
|
responses_websockets_enabled=True,
|
|
223
224
|
request_compression_enabled=True,
|
|
224
225
|
approval_policy="on-request",
|
|
@@ -246,6 +247,7 @@ Important mappings to the Codex CLI:
|
|
|
246
247
|
- `exec_policy_enabled` maps to `--config features.exec_policy=...`.
|
|
247
248
|
- `remote_models_enabled` maps to `--config features.remote_models=...`.
|
|
248
249
|
- `collaboration_modes_enabled` maps to `--config features.collaboration_modes=...`.
|
|
250
|
+
- `connectors_enabled` maps to `--config features.connectors=...`.
|
|
249
251
|
- `responses_websockets_enabled` maps to `--config features.responses_websockets=...`.
|
|
250
252
|
- `request_compression_enabled` maps to `--config features.enable_request_compression=...`.
|
|
251
253
|
- `feature_overrides` maps to `--config features.<key>=...` (explicit options take precedence).
|
|
@@ -253,6 +255,7 @@ Important mappings to the Codex CLI:
|
|
|
253
255
|
- `config_overrides` maps to repeated `--config key=value` entries.
|
|
254
256
|
|
|
255
257
|
Note: `skills_enabled` is deprecated in Codex 0.80+ (skills are always enabled).
|
|
258
|
+
Note: Codex defaults `agents.max_threads` to 6; `max_threads` must be `>= 1` if set.
|
|
256
259
|
Note: Codex 0.88.0+ ignores `experimental_instructions_file`; use
|
|
257
260
|
`model_instructions_file` instead.
|
|
258
261
|
|
|
@@ -307,12 +310,14 @@ default prompt) for richer UI integrations.
|
|
|
307
310
|
|
|
308
311
|
The SDK also exposes helpers for most app-server endpoints:
|
|
309
312
|
|
|
310
|
-
- 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`
|
|
311
316
|
- Config: `config_read`, `config_value_write`, `config_batch_write`, `config_requirements_read`
|
|
312
|
-
- Skills: `skills_list`
|
|
317
|
+
- Skills: `skills_list`, `skills_remote_read`, `skills_remote_write`, `skills_config_write`
|
|
313
318
|
- Turns/review: `turn_start`, `turn_interrupt`, `review_start`, `turn_session`
|
|
314
319
|
- Models: `model_list`
|
|
315
|
-
- Collaboration modes: `collaboration_mode_list`
|
|
320
|
+
- Collaboration modes: `collaboration_mode_list` (experimental)
|
|
316
321
|
- One-off commands: `command_exec`
|
|
317
322
|
- MCP auth/status: `mcp_server_oauth_login`, `mcp_server_refresh`, `mcp_server_status_list`
|
|
318
323
|
- Account: `account_login_start`, `account_login_cancel`, `account_logout`,
|
|
@@ -322,7 +327,10 @@ The SDK also exposes helpers for most app-server endpoints:
|
|
|
322
327
|
These map 1:1 to the Codex app-server protocol; see `codex/codex-rs/app-server/README.md`
|
|
323
328
|
for payload shapes and event semantics.
|
|
324
329
|
|
|
325
|
-
|
|
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`
|
|
326
334
|
to compute the effective layered config for a specific working directory.
|
|
327
335
|
|
|
328
336
|
### Observability (OTEL) and notify
|
|
@@ -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.98.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"}
|
|
@@ -40,7 +40,10 @@ pydantic-ai = [
|
|
|
40
40
|
"pydantic-ai; python_version >= '3.10'",
|
|
41
41
|
]
|
|
42
42
|
logfire = [
|
|
43
|
-
|
|
43
|
+
# `pydantic-ai` imports the `logfire` module, which is provided by the
|
|
44
|
+
# `logfire-api` distribution. Avoid the unrelated legacy `logfire` package
|
|
45
|
+
# on PyPI which can shadow it and break imports.
|
|
46
|
+
"logfire-api>=4",
|
|
44
47
|
]
|
|
45
48
|
|
|
46
49
|
[dependency-groups]
|
|
@@ -41,6 +41,11 @@ from .exceptions import (
|
|
|
41
41
|
from .hooks import ThreadHooks
|
|
42
42
|
from .items import (
|
|
43
43
|
AgentMessageItem,
|
|
44
|
+
CollabAgentState,
|
|
45
|
+
CollabAgentStatus,
|
|
46
|
+
CollabTool,
|
|
47
|
+
CollabToolCallItem,
|
|
48
|
+
CollabToolCallStatus,
|
|
44
49
|
CommandExecutionItem,
|
|
45
50
|
CommandExecutionStatus,
|
|
46
51
|
ErrorItem,
|
|
@@ -77,7 +82,7 @@ from .thread import (
|
|
|
77
82
|
Turn,
|
|
78
83
|
)
|
|
79
84
|
|
|
80
|
-
__version__ = "0.
|
|
85
|
+
__version__ = "0.98.0"
|
|
81
86
|
|
|
82
87
|
__all__ = [
|
|
83
88
|
"AbortController",
|
|
@@ -117,6 +122,7 @@ __all__ = [
|
|
|
117
122
|
"CommandExecutionItem",
|
|
118
123
|
"FileChangeItem",
|
|
119
124
|
"McpToolCallItem",
|
|
125
|
+
"CollabToolCallItem",
|
|
120
126
|
"McpToolCallItemResult",
|
|
121
127
|
"McpToolCallItemError",
|
|
122
128
|
"WebSearchItem",
|
|
@@ -126,6 +132,10 @@ __all__ = [
|
|
|
126
132
|
"PatchChangeKind",
|
|
127
133
|
"PatchApplyStatus",
|
|
128
134
|
"McpToolCallStatus",
|
|
135
|
+
"CollabToolCallStatus",
|
|
136
|
+
"CollabTool",
|
|
137
|
+
"CollabAgentStatus",
|
|
138
|
+
"CollabAgentState",
|
|
129
139
|
"TodoItem",
|
|
130
140
|
"CodexOptions",
|
|
131
141
|
"ThreadOptions",
|
|
@@ -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()
|