codex-sdk-python 0.104.1__tar.gz → 0.114.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.104.1 → codex_sdk_python-0.114.0}/PKG-INFO +51 -31
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/README.md +48 -28
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/pyproject.toml +8 -5
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/__init__.py +11 -5
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/app_server.py +267 -209
- codex_sdk_python-0.114.0/src/codex_sdk/integrations/pydantic_ai_model.py +1324 -0
- codex_sdk_python-0.104.1/src/codex_sdk/integrations/pydantic_ai_model.py +0 -663
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/abort.py +0 -0
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/codex.py +0 -0
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/config_overrides.py +0 -0
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/events.py +0 -0
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/exceptions.py +0 -0
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/exec.py +0 -0
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/hooks.py +0 -0
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/integrations/__init__.py +0 -0
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/integrations/pydantic_ai.py +0 -0
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/items.py +0 -0
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/options.py +0 -0
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/telemetry.py +0 -0
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/thread.py +0 -0
- {codex_sdk_python-0.104.1 → codex_sdk_python-0.114.0}/src/codex_sdk/tool_envelope.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.114.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,9 +18,9 @@ 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
|
-
Requires-Dist: pydantic-ai ; python_full_version >= '3.10' and extra == 'pydantic-ai'
|
|
23
|
+
Requires-Dist: pydantic-ai>=1.68.0,<2 ; python_full_version >= '3.10' and extra == 'pydantic-ai'
|
|
24
24
|
Maintainer: Vectorfy Co
|
|
25
25
|
Maintainer-email: Vectorfy Co <git@vectorfy.co>
|
|
26
26
|
Requires-Python: >=3.8
|
|
@@ -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.114.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>
|
|
@@ -347,15 +347,20 @@ default prompt) for richer UI integrations.
|
|
|
347
347
|
The SDK also exposes helpers for most app-server endpoints:
|
|
348
348
|
|
|
349
349
|
- Threads: `thread_start`, `thread_resume`, `thread_fork`, `thread_list`, `thread_loaded_list`,
|
|
350
|
-
`thread_read`, `thread_archive`, `
|
|
351
|
-
`thread_compact_start`, `thread_rollback`
|
|
350
|
+
`thread_read`, `thread_archive`, `thread_unsubscribe`, `thread_unarchive`,
|
|
351
|
+
`thread_name_set`, `thread_compact_start`, `thread_rollback`, `thread_metadata_update`
|
|
352
352
|
- Config: `config_read`, `config_value_write`, `config_batch_write`, `config_requirements_read`
|
|
353
|
-
- Skills: `skills_list`, `
|
|
354
|
-
|
|
355
|
-
-
|
|
353
|
+
- Skills: `skills_list`, `skills_remote_list`, `skills_remote_export`, `skills_remote_read` (alias),
|
|
354
|
+
`skills_remote_write` (alias), `skills_config_write`
|
|
355
|
+
- Turns/review: `turn_start`, `turn_steer`, `turn_interrupt`, `review_start`, `turn_session`
|
|
356
|
+
- Models: `model_list`, `experimental_feature_list`
|
|
356
357
|
- Collaboration modes: `collaboration_mode_list` (experimental)
|
|
357
|
-
-
|
|
358
|
+
- Plugins: `plugin_list`, `plugin_install`, `plugin_uninstall`
|
|
359
|
+
- One-off commands: `command_exec`, `command_exec_write`, `command_exec_resize`,
|
|
360
|
+
`command_exec_terminate`
|
|
358
361
|
- MCP auth/status: `mcp_server_oauth_login`, `mcp_server_refresh`, `mcp_server_status_list`
|
|
362
|
+
- External agent config: `external_agent_config_detect`, `external_agent_config_import`
|
|
363
|
+
- Windows sandbox: `windows_sandbox_setup_start`
|
|
359
364
|
- Account: `account_login_start`, `account_login_cancel`, `account_logout`,
|
|
360
365
|
`account_rate_limits_read`, `account_read`
|
|
361
366
|
- Feedback: `feedback_upload`
|
|
@@ -366,21 +371,11 @@ for payload shapes and event semantics.
|
|
|
366
371
|
Note: some endpoints and fields are gated behind an experimental capability; set
|
|
367
372
|
`AppServerOptions(experimental_api_enabled=True)` to opt in.
|
|
368
373
|
|
|
369
|
-
`
|
|
370
|
-
|
|
371
|
-
working directory.
|
|
374
|
+
`ApprovalDecisions` also supports `permissions_request` for auto-responding to
|
|
375
|
+
`item/permissions/requestApproval` server requests during `turn_session()`.
|
|
372
376
|
|
|
373
|
-
`
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
```python
|
|
377
|
-
threads = await app.thread_list(archived=False, sort_key="updatedAt", source_kinds=["local"], cwd=".")
|
|
378
|
-
config = await app.config_read(include_layers=True, cwd=".")
|
|
379
|
-
skills = await app.skills_remote_read(
|
|
380
|
-
cwds=["."], enabled=True, hazelnut_scope="user", product_surface="codex_desktop"
|
|
381
|
-
)
|
|
382
|
-
models = await app.model_list(limit=20, include_hidden=False)
|
|
383
|
-
```
|
|
377
|
+
`thread_list` supports `archived`, `sort_key`, and `source_kinds` filters, and `config_read` accepts an optional `cwd`
|
|
378
|
+
to compute the effective layered config for a specific working directory.
|
|
384
379
|
|
|
385
380
|
### Observability (OTEL) and notify
|
|
386
381
|
|
|
@@ -423,9 +418,8 @@ Supported target triples:
|
|
|
423
418
|
- macOS: `x86_64-apple-darwin`, `aarch64-apple-darwin`
|
|
424
419
|
- Windows: `x86_64-pc-windows-msvc`, `aarch64-pc-windows-msvc`
|
|
425
420
|
|
|
426
|
-
If you are working from source and the vendor directory is missing, run
|
|
427
|
-
`
|
|
428
|
-
artifacts into `src/codex_sdk/vendor/`.
|
|
421
|
+
If you are working from source and the vendor directory is missing, run `python scripts/setup_binary.py`
|
|
422
|
+
or follow `SETUP.md` to download the official npm package and copy the `vendor/` directory.
|
|
429
423
|
|
|
430
424
|
<a id="auth"></a>
|
|
431
425
|
## 
|
|
@@ -518,6 +512,7 @@ print(turn.final_response)
|
|
|
518
512
|
- `command_execution`
|
|
519
513
|
- `file_change`
|
|
520
514
|
- `mcp_tool_call`
|
|
515
|
+
- `collab_tool_call`
|
|
521
516
|
- `web_search`
|
|
522
517
|
- `todo_list`
|
|
523
518
|
- `error`
|
|
@@ -594,7 +589,8 @@ last_thread = codex.resume_last_thread()
|
|
|
594
589
|
### Turn helpers
|
|
595
590
|
|
|
596
591
|
Each `Turn` provides convenience filters: `agent_messages()`, `reasoning()`, `commands()`,
|
|
597
|
-
`file_changes()`, `mcp_tool_calls()`, `
|
|
592
|
+
`file_changes()`, `mcp_tool_calls()`, `collab_tool_calls()`, `web_searches()`,
|
|
593
|
+
`todo_lists()`, and `errors()`.
|
|
598
594
|
|
|
599
595
|
<a id="api"></a>
|
|
600
596
|
## 
|
|
@@ -615,7 +611,12 @@ Exceptions:
|
|
|
615
611
|
Typed events and items:
|
|
616
612
|
- `ThreadEvent` union of `thread.*`, `turn.*`, `item.*`, and `error` events.
|
|
617
613
|
- `ThreadItem` union of `agent_message`, `reasoning`, `command_execution`, `file_change`,
|
|
618
|
-
`mcp_tool_call`, `web_search`, `todo_list`, `error`.
|
|
614
|
+
`mcp_tool_call`, `collab_tool_call`, `web_search`, `todo_list`, `error`.
|
|
615
|
+
- `CollabToolCallItem`: typed item for `collab_tool_call` thread history entries.
|
|
616
|
+
- `CollabToolCallStatus`: typed status values for collaboration tool calls.
|
|
617
|
+
- `CollabTool`: collaboration tool metadata attached to `CollabToolCallItem`.
|
|
618
|
+
- `CollabAgentStatus`: agent lifecycle status attached to collaboration state updates.
|
|
619
|
+
- `CollabAgentState`: agent metadata/state payload emitted for collaboration items.
|
|
619
620
|
|
|
620
621
|
<a id="examples"></a>
|
|
621
622
|
## 
|
|
@@ -632,6 +633,7 @@ Example scripts under `examples/`:
|
|
|
632
633
|
- `hooks_streaming.py`: event hooks for streaming runs.
|
|
633
634
|
- `notify_hook.py`: notify script for CLI callbacks.
|
|
634
635
|
- `pydantic_ai_model_provider.py`: Codex as a PydanticAI model provider.
|
|
636
|
+
- `pydantic_ai_model_provider_streaming.py`: live PydanticAI text streaming over `CodexModel`.
|
|
635
637
|
- `pydantic_ai_handoff.py`: Codex as a PydanticAI tool.
|
|
636
638
|
|
|
637
639
|
<a id="sandbox"></a>
|
|
@@ -681,12 +683,30 @@ result = agent.run_sync("What's 19 + 23? Use the add tool.")
|
|
|
681
683
|
print(result.output)
|
|
682
684
|
```
|
|
683
685
|
|
|
686
|
+
For live text streaming in a terminal or web UI:
|
|
687
|
+
|
|
688
|
+
```python
|
|
689
|
+
from pydantic_ai import Agent
|
|
690
|
+
|
|
691
|
+
from codex_sdk.integrations.pydantic_ai_model import CodexModel
|
|
692
|
+
|
|
693
|
+
agent = Agent(CodexModel(), output_type=str)
|
|
694
|
+
|
|
695
|
+
async with agent.run_stream("Explain why the sky is blue.") as result:
|
|
696
|
+
async for delta in result.stream_text(delta=True, debounce_by=None):
|
|
697
|
+
print(delta, end="", flush=True)
|
|
698
|
+
```
|
|
699
|
+
|
|
684
700
|
How it works:
|
|
685
701
|
- `CodexModel` builds a JSON schema envelope with `tool_calls` and `final`.
|
|
686
702
|
- Codex emits tool calls as JSON strings; PydanticAI runs them.
|
|
687
703
|
- If `allow_text_output` is true, Codex can place final text in `final`.
|
|
688
|
-
-
|
|
689
|
-
|
|
704
|
+
- This SDK targets the current PydanticAI release line (`>=1.68.0,<2`).
|
|
705
|
+
- `Agent.run_stream()`, `Agent.run_stream_events()`, and `Agent.run_stream_sync()`
|
|
706
|
+
work with `CodexModel`.
|
|
707
|
+
- Text deltas are forwarded live from agent-message updates when Codex emits them, including
|
|
708
|
+
envelope-backed `final` text. Tool calls are forwarded as soon as Codex produces a valid
|
|
709
|
+
envelope update, and `streamed.get()` is reconciled to the canonical final turn result.
|
|
690
710
|
|
|
691
711
|
Safety defaults (you can override with your own `ThreadOptions`):
|
|
692
712
|
- `sandbox_mode="read-only"`
|
|
@@ -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.114.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>
|
|
@@ -311,15 +311,20 @@ default prompt) for richer UI integrations.
|
|
|
311
311
|
The SDK also exposes helpers for most app-server endpoints:
|
|
312
312
|
|
|
313
313
|
- Threads: `thread_start`, `thread_resume`, `thread_fork`, `thread_list`, `thread_loaded_list`,
|
|
314
|
-
`thread_read`, `thread_archive`, `
|
|
315
|
-
`thread_compact_start`, `thread_rollback`
|
|
314
|
+
`thread_read`, `thread_archive`, `thread_unsubscribe`, `thread_unarchive`,
|
|
315
|
+
`thread_name_set`, `thread_compact_start`, `thread_rollback`, `thread_metadata_update`
|
|
316
316
|
- Config: `config_read`, `config_value_write`, `config_batch_write`, `config_requirements_read`
|
|
317
|
-
- Skills: `skills_list`, `
|
|
318
|
-
|
|
319
|
-
-
|
|
317
|
+
- Skills: `skills_list`, `skills_remote_list`, `skills_remote_export`, `skills_remote_read` (alias),
|
|
318
|
+
`skills_remote_write` (alias), `skills_config_write`
|
|
319
|
+
- Turns/review: `turn_start`, `turn_steer`, `turn_interrupt`, `review_start`, `turn_session`
|
|
320
|
+
- Models: `model_list`, `experimental_feature_list`
|
|
320
321
|
- Collaboration modes: `collaboration_mode_list` (experimental)
|
|
321
|
-
-
|
|
322
|
+
- Plugins: `plugin_list`, `plugin_install`, `plugin_uninstall`
|
|
323
|
+
- One-off commands: `command_exec`, `command_exec_write`, `command_exec_resize`,
|
|
324
|
+
`command_exec_terminate`
|
|
322
325
|
- MCP auth/status: `mcp_server_oauth_login`, `mcp_server_refresh`, `mcp_server_status_list`
|
|
326
|
+
- External agent config: `external_agent_config_detect`, `external_agent_config_import`
|
|
327
|
+
- Windows sandbox: `windows_sandbox_setup_start`
|
|
323
328
|
- Account: `account_login_start`, `account_login_cancel`, `account_logout`,
|
|
324
329
|
`account_rate_limits_read`, `account_read`
|
|
325
330
|
- Feedback: `feedback_upload`
|
|
@@ -330,21 +335,11 @@ for payload shapes and event semantics.
|
|
|
330
335
|
Note: some endpoints and fields are gated behind an experimental capability; set
|
|
331
336
|
`AppServerOptions(experimental_api_enabled=True)` to opt in.
|
|
332
337
|
|
|
333
|
-
`
|
|
334
|
-
|
|
335
|
-
working directory.
|
|
338
|
+
`ApprovalDecisions` also supports `permissions_request` for auto-responding to
|
|
339
|
+
`item/permissions/requestApproval` server requests during `turn_session()`.
|
|
336
340
|
|
|
337
|
-
`
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
```python
|
|
341
|
-
threads = await app.thread_list(archived=False, sort_key="updatedAt", source_kinds=["local"], cwd=".")
|
|
342
|
-
config = await app.config_read(include_layers=True, cwd=".")
|
|
343
|
-
skills = await app.skills_remote_read(
|
|
344
|
-
cwds=["."], enabled=True, hazelnut_scope="user", product_surface="codex_desktop"
|
|
345
|
-
)
|
|
346
|
-
models = await app.model_list(limit=20, include_hidden=False)
|
|
347
|
-
```
|
|
341
|
+
`thread_list` supports `archived`, `sort_key`, and `source_kinds` filters, and `config_read` accepts an optional `cwd`
|
|
342
|
+
to compute the effective layered config for a specific working directory.
|
|
348
343
|
|
|
349
344
|
### Observability (OTEL) and notify
|
|
350
345
|
|
|
@@ -387,9 +382,8 @@ Supported target triples:
|
|
|
387
382
|
- macOS: `x86_64-apple-darwin`, `aarch64-apple-darwin`
|
|
388
383
|
- Windows: `x86_64-pc-windows-msvc`, `aarch64-pc-windows-msvc`
|
|
389
384
|
|
|
390
|
-
If you are working from source and the vendor directory is missing, run
|
|
391
|
-
`
|
|
392
|
-
artifacts into `src/codex_sdk/vendor/`.
|
|
385
|
+
If you are working from source and the vendor directory is missing, run `python scripts/setup_binary.py`
|
|
386
|
+
or follow `SETUP.md` to download the official npm package and copy the `vendor/` directory.
|
|
393
387
|
|
|
394
388
|
<a id="auth"></a>
|
|
395
389
|
## 
|
|
@@ -482,6 +476,7 @@ print(turn.final_response)
|
|
|
482
476
|
- `command_execution`
|
|
483
477
|
- `file_change`
|
|
484
478
|
- `mcp_tool_call`
|
|
479
|
+
- `collab_tool_call`
|
|
485
480
|
- `web_search`
|
|
486
481
|
- `todo_list`
|
|
487
482
|
- `error`
|
|
@@ -558,7 +553,8 @@ last_thread = codex.resume_last_thread()
|
|
|
558
553
|
### Turn helpers
|
|
559
554
|
|
|
560
555
|
Each `Turn` provides convenience filters: `agent_messages()`, `reasoning()`, `commands()`,
|
|
561
|
-
`file_changes()`, `mcp_tool_calls()`, `
|
|
556
|
+
`file_changes()`, `mcp_tool_calls()`, `collab_tool_calls()`, `web_searches()`,
|
|
557
|
+
`todo_lists()`, and `errors()`.
|
|
562
558
|
|
|
563
559
|
<a id="api"></a>
|
|
564
560
|
## 
|
|
@@ -579,7 +575,12 @@ Exceptions:
|
|
|
579
575
|
Typed events and items:
|
|
580
576
|
- `ThreadEvent` union of `thread.*`, `turn.*`, `item.*`, and `error` events.
|
|
581
577
|
- `ThreadItem` union of `agent_message`, `reasoning`, `command_execution`, `file_change`,
|
|
582
|
-
`mcp_tool_call`, `web_search`, `todo_list`, `error`.
|
|
578
|
+
`mcp_tool_call`, `collab_tool_call`, `web_search`, `todo_list`, `error`.
|
|
579
|
+
- `CollabToolCallItem`: typed item for `collab_tool_call` thread history entries.
|
|
580
|
+
- `CollabToolCallStatus`: typed status values for collaboration tool calls.
|
|
581
|
+
- `CollabTool`: collaboration tool metadata attached to `CollabToolCallItem`.
|
|
582
|
+
- `CollabAgentStatus`: agent lifecycle status attached to collaboration state updates.
|
|
583
|
+
- `CollabAgentState`: agent metadata/state payload emitted for collaboration items.
|
|
583
584
|
|
|
584
585
|
<a id="examples"></a>
|
|
585
586
|
## 
|
|
@@ -596,6 +597,7 @@ Example scripts under `examples/`:
|
|
|
596
597
|
- `hooks_streaming.py`: event hooks for streaming runs.
|
|
597
598
|
- `notify_hook.py`: notify script for CLI callbacks.
|
|
598
599
|
- `pydantic_ai_model_provider.py`: Codex as a PydanticAI model provider.
|
|
600
|
+
- `pydantic_ai_model_provider_streaming.py`: live PydanticAI text streaming over `CodexModel`.
|
|
599
601
|
- `pydantic_ai_handoff.py`: Codex as a PydanticAI tool.
|
|
600
602
|
|
|
601
603
|
<a id="sandbox"></a>
|
|
@@ -645,12 +647,30 @@ result = agent.run_sync("What's 19 + 23? Use the add tool.")
|
|
|
645
647
|
print(result.output)
|
|
646
648
|
```
|
|
647
649
|
|
|
650
|
+
For live text streaming in a terminal or web UI:
|
|
651
|
+
|
|
652
|
+
```python
|
|
653
|
+
from pydantic_ai import Agent
|
|
654
|
+
|
|
655
|
+
from codex_sdk.integrations.pydantic_ai_model import CodexModel
|
|
656
|
+
|
|
657
|
+
agent = Agent(CodexModel(), output_type=str)
|
|
658
|
+
|
|
659
|
+
async with agent.run_stream("Explain why the sky is blue.") as result:
|
|
660
|
+
async for delta in result.stream_text(delta=True, debounce_by=None):
|
|
661
|
+
print(delta, end="", flush=True)
|
|
662
|
+
```
|
|
663
|
+
|
|
648
664
|
How it works:
|
|
649
665
|
- `CodexModel` builds a JSON schema envelope with `tool_calls` and `final`.
|
|
650
666
|
- Codex emits tool calls as JSON strings; PydanticAI runs them.
|
|
651
667
|
- If `allow_text_output` is true, Codex can place final text in `final`.
|
|
652
|
-
-
|
|
653
|
-
|
|
668
|
+
- This SDK targets the current PydanticAI release line (`>=1.68.0,<2`).
|
|
669
|
+
- `Agent.run_stream()`, `Agent.run_stream_events()`, and `Agent.run_stream_sync()`
|
|
670
|
+
work with `CodexModel`.
|
|
671
|
+
- Text deltas are forwarded live from agent-message updates when Codex emits them, including
|
|
672
|
+
envelope-backed `final` text. Tool calls are forwarded as soon as Codex produces a valid
|
|
673
|
+
envelope update, and `streamed.get()` is reconciled to the canonical final turn result.
|
|
654
674
|
|
|
655
675
|
Safety defaults (you can override with your own `ThreadOptions`):
|
|
656
676
|
- `sandbox_mode="read-only"`
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["uv_build>=0.9.21,<0.
|
|
2
|
+
requires = ["uv_build>=0.9.21,<0.10.0"]
|
|
3
3
|
build-backend = "uv_build"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "codex-sdk-python"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.114.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"}
|
|
@@ -37,10 +37,13 @@ pydantic = [
|
|
|
37
37
|
"pydantic>=2",
|
|
38
38
|
]
|
|
39
39
|
pydantic-ai = [
|
|
40
|
-
"pydantic-ai; python_version >= '3.10'",
|
|
40
|
+
"pydantic-ai>=1.68.0,<2; 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]
|
|
@@ -49,7 +52,7 @@ dev = [
|
|
|
49
52
|
"pytest-asyncio>=0.21.0",
|
|
50
53
|
"pytest-cov>=4.0",
|
|
51
54
|
"pydantic>=2",
|
|
52
|
-
"pydantic-ai; python_version >= '3.10'",
|
|
55
|
+
"pydantic-ai>=1.68.0,<2; python_version >= '3.10'",
|
|
53
56
|
"black>=22.0",
|
|
54
57
|
"isort>=5.0",
|
|
55
58
|
"mypy>=1.0",
|
|
@@ -15,8 +15,6 @@ from .app_server import (
|
|
|
15
15
|
AppServerRequest,
|
|
16
16
|
AppServerTurnSession,
|
|
17
17
|
AppServerUserInput,
|
|
18
|
-
SkillsRemoteReadRequest,
|
|
19
|
-
SkillsRemoteWriteRequest,
|
|
20
18
|
)
|
|
21
19
|
from .codex import Codex
|
|
22
20
|
from .events import (
|
|
@@ -43,6 +41,11 @@ from .exceptions import (
|
|
|
43
41
|
from .hooks import ThreadHooks
|
|
44
42
|
from .items import (
|
|
45
43
|
AgentMessageItem,
|
|
44
|
+
CollabAgentState,
|
|
45
|
+
CollabAgentStatus,
|
|
46
|
+
CollabTool,
|
|
47
|
+
CollabToolCallItem,
|
|
48
|
+
CollabToolCallStatus,
|
|
46
49
|
CommandExecutionItem,
|
|
47
50
|
CommandExecutionStatus,
|
|
48
51
|
ErrorItem,
|
|
@@ -79,7 +82,7 @@ from .thread import (
|
|
|
79
82
|
Turn,
|
|
80
83
|
)
|
|
81
84
|
|
|
82
|
-
__version__ = "0.
|
|
85
|
+
__version__ = "0.114.0"
|
|
83
86
|
|
|
84
87
|
__all__ = [
|
|
85
88
|
"AbortController",
|
|
@@ -94,8 +97,6 @@ __all__ = [
|
|
|
94
97
|
"ApprovalDecisions",
|
|
95
98
|
"AppServerInput",
|
|
96
99
|
"AppServerUserInput",
|
|
97
|
-
"SkillsRemoteReadRequest",
|
|
98
|
-
"SkillsRemoteWriteRequest",
|
|
99
100
|
"Thread",
|
|
100
101
|
"ThreadHooks",
|
|
101
102
|
"Input",
|
|
@@ -121,6 +122,7 @@ __all__ = [
|
|
|
121
122
|
"CommandExecutionItem",
|
|
122
123
|
"FileChangeItem",
|
|
123
124
|
"McpToolCallItem",
|
|
125
|
+
"CollabToolCallItem",
|
|
124
126
|
"McpToolCallItemResult",
|
|
125
127
|
"McpToolCallItemError",
|
|
126
128
|
"WebSearchItem",
|
|
@@ -130,6 +132,10 @@ __all__ = [
|
|
|
130
132
|
"PatchChangeKind",
|
|
131
133
|
"PatchApplyStatus",
|
|
132
134
|
"McpToolCallStatus",
|
|
135
|
+
"CollabToolCallStatus",
|
|
136
|
+
"CollabTool",
|
|
137
|
+
"CollabAgentStatus",
|
|
138
|
+
"CollabAgentState",
|
|
133
139
|
"TodoItem",
|
|
134
140
|
"CodexOptions",
|
|
135
141
|
"ThreadOptions",
|