codexed
Class info¶
Re-exported classes¶
| Class | Module | Description |
|---|---|---|
| AgentMessageDeltaNotification | codexed.models.v2_protocol | |
| AppInfo | codexed.models.v2_protocol | EXPERIMENTAL - app metadata returned by app-list APIs. |
| AppListUpdatedMessage | codexed.models.v2_protocol | Notification sent from the server to the client. |
| AppListUpdatedNotification | codexed.models.v2_protocol | EXPERIMENTAL - notification emitted when the app list changes. |
| BuiltinToolsConfig | codexed.models.tool_config | Combined configuration for all Codex builtin tools. |
| CodexClient | codexed.client.client | Client for the Codex app-server JSON-RPC protocol. |
| CodexError | codexed.exceptions | Base exception for Codex adapter errors. |
| CodexProcessError | codexed.exceptions | Error starting or communicating with the Codex app-server process. |
| CodexRequestError | codexed.exceptions | Error from a Codex app-server request (JSON-RPC error response). |
| CollaborationMode | codexed.models.v2_protocol | Collaboration mode for a Codex session. |
| CommandExecResponse | codexed.models.v2_protocol | Final buffered result for command/exec. |
| CommandExecutionOutputDeltaNotification | codexed.models.v2_protocol | |
| ConfigWarningMessage | codexed.models.v2_protocol | Notification sent from the server to the client. |
| ConfigWarningNotification | codexed.models.v2_protocol | |
| DangerFullAccessSandboxPolicy | codexed.models.v2_protocol | |
| ExperimentalFeature | codexed.models.v2_protocol | |
| ExternalSandboxSandboxPolicy | codexed.models.v2_protocol | |
| FsChangedMessage | codexed.models.v2_protocol | Notification sent from the server to the client. |
| HttpMcpServer | codexed.models.mcp_server | MCP server accessible via HTTP/SSE transport. |
| InternalRpcError | codexed.exceptions | JSON-RPC internal error (-32603). |
| InvalidParamsError | codexed.exceptions | JSON-RPC invalid params (-32602). |
| InvalidRequestError | codexed.exceptions | JSON-RPC invalid request (-32600). |
| ItemAgentMessageDeltaNotification | codexed.models.v2_protocol | Notification sent from the server to the client. |
| ItemCommandExecutionOutputDeltaNotification | codexed.models.v2_protocol | Notification sent from the server to the client. |
| ItemCompletedEvent | codexed.models.events | Item completed event. |
| ItemFileChangeOutputDeltaNotification | codexed.models.v2_protocol | Deprecated legacy apply_patch output stream notification. |
| ItemPlanDeltaNotification | codexed.models.v2_protocol | EXPERIMENTAL - proposed plan streaming deltas for plan items. |
| ItemReasoningTextDeltaNotification | codexed.models.v2_protocol | Notification sent from the server to the client. |
| ItemStartedEvent | codexed.models.events | Item started event. |
| LocalImageUserInput | codexed.models.v2_protocol | |
| MentionUserInput | codexed.models.v2_protocol | |
| MethodNotFoundError | codexed.exceptions | JSON-RPC method not found (-32601). |
| Model | codexed.models.v2_protocol | |
| ModelReroutedMessage | codexed.models.v2_protocol | Notification sent from the server to the client. |
| ModelReroutedNotification | codexed.models.v2_protocol | |
| ParseError | codexed.exceptions | JSON-RPC parse error (-32700). |
| PlanDeltaNotification | codexed.models.v2_protocol | EXPERIMENTAL - proposed plan streaming deltas for plan items. Clients should not assume concatenated deltas match the completed plan item content. |
| ReadOnlySandboxPolicy | codexed.models.v2_protocol | |
| ReasoningTextDeltaNotification | codexed.models.v2_protocol | |
| RetryLimitExceededError | codexed.exceptions | Server exhausted internal retry budget for a retryable operation. |
| ReviewStartResponse | codexed.models.responses | Response for review/start request. |
| ServerBusyError | codexed.exceptions | Server is overloaded / unavailable and caller should retry. |
| Session | codexed.client.session | Runtime handle for an active Codex thread. |
| Settings | codexed.models.v2_protocol | Settings for a collaboration mode. |
| SkillMetadata | codexed.models.v2_protocol | |
| SkillUserInput | codexed.models.v2_protocol | |
| StdioMcpServer | codexed.models.mcp_server | MCP server running as a subprocess via stdio transport. |
| StdioTransport | codexed.transport | Transport that communicates with a Codex app-server subprocess via stdin/stdout. |
| TextUserInput | codexed.models.v2_protocol | |
| Thread | codexed.models.misc | |
| ThreadArchivedMessage | codexed.models.v2_protocol | Notification sent from the server to the client. |
| ThreadArchivedNotification | codexed.models.v2_protocol | |
| ThreadCompactedMessage | codexed.models.v2_protocol | Deprecated: Use ContextCompaction item type instead. |
| ThreadListResponse | codexed.models.responses | Response for thread/list request. |
| ThreadNameUpdatedMessage | codexed.models.v2_protocol | Notification sent from the server to the client. |
| ThreadNameUpdatedNotification | codexed.models.v2_protocol | |
| ThreadReadResponse | codexed.models.responses | Response for thread/read request. |
| ThreadResponse | codexed.models.responses | Response for thread/start, thread/resume, and thread/fork. |
| ThreadRevertResponse | codexed.models.responses | Response for thread/revert request. |
| ThreadStartedData | codexed.models.event_data | Payload for thread/started notification (V2 protocol). |
| ThreadStartedEvent | codexed.models.events | Thread started event. |
| ThreadStatusChangedMessage | codexed.models.v2_protocol | Notification sent from the server to the client. |
| ThreadStatusChangedNotification | codexed.models.v2_protocol | |
| ThreadTokenUsage | codexed.models.v2_protocol | |
| ThreadUnarchiveParams | codexed.models.v2_protocol | |
| ThreadUnarchiveResponse | codexed.models.responses | Response for thread/unarchive request. |
| ThreadUnarchivedMessage | codexed.models.v2_protocol | Notification sent from the server to the client. |
| TokenUsageBreakdown | codexed.models.v2_protocol | |
| TransportClosedError | codexed.exceptions | Raised when the app-server transport closes unexpectedly. |
| TurnCompletedData | codexed.models.event_data | Payload for turn/completed notification (V2 protocol). |
| TurnCompletedEvent | codexed.models.events | Turn completed event. |
| TurnFailedError | codexed.exceptions | Raised when a turn completes with failed status. |
| TurnPlanUpdatedMessage | codexed.models.v2_protocol | Notification sent from the server to the client. |
| TurnStartedData | codexed.models.event_data | Payload for turn/started notification (V2 protocol). |
| TurnStartedEvent | codexed.models.events | Turn started event. |
| TurnSteerResponse | codexed.models.v2_protocol | |
| WebSocketTransport | codexed.transport | Transport that connects to a remote Codex app-server via WebSocket. |
| WorkspaceWriteSandboxPolicy | codexed.models.v2_protocol |
🛈 DocStrings¶
Codexed: main package.
Alternative codex app-server client.
ToolConfig
module-attribute
¶
ToolConfig = Annotated[
ShellToolConfig
| ApplyPatchToolConfig
| WebSearchToolConfig
| ImageGenerationToolConfig
| ViewImageToolConfig
| PlanToolConfig
| JsReplToolConfig
| CollabToolsConfig
| AgentJobsToolsConfig
| RequestUserInputToolConfig
| RequestPermissionsToolConfig
| ArtifactsToolConfig
| GrepFilesToolConfig
| ReadFileToolConfig
| ListDirToolConfig
| ToolSearchToolConfig
| ToolSuggestToolConfig
| McpResourceToolsConfig,
Discriminator("type"),
]
Discriminated union of all builtin tool configurations.
InputModality
¶
Canonical user-input modality tags advertised by a model.
MessagePhase
¶
Classifies assistant text as commentary, a partial answer, or a terminal answer.
Providers do not emit this consistently, so callers must treat None as "phase unknown" and keep compatibility behavior for legacy models.
ModeKind
¶
Initial collaboration mode to use when the TUI starts.
Personality
¶
Deprecated: friendly and pragmatic no longer select a style.
ReasoningEffort
¶
A non-empty reasoning effort value advertised by the model.
ReasoningSummary
¶
A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries
AppInfo
¶
Bases: CodexBaseModel
EXPERIMENTAL - app metadata returned by app-list APIs.
Source code in src/codexed/models/v2_protocol.py
is_enabled
class-attribute
instance-attribute
¶
Whether this app is enabled in config.toml. Example: toml [apps.bad_app] enabled = false
AppListUpdatedMessage
¶
Bases: CodexBaseModel
Notification sent from the server to the client.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
AppListUpdatedNotification
¶
Bases: CodexBaseModel
EXPERIMENTAL - notification emitted when the app list changes.
Source code in src/codexed/models/v2_protocol.py
BuiltinToolsConfig
¶
Bases: BaseModel
Combined configuration for all Codex builtin tools.
Provides named fields as a convenience over list[ToolConfig].
Call :meth:to_config_dict to obtain the config dict for
ThreadStartParams, or :meth:to_tool_list to get a
list[ToolConfig].
Example::
tools = BuiltinToolsConfig(
web_search=WebSearchToolConfig(mode="live", context_size="high"),
js_repl=JsReplToolConfig(),
)
params = ThreadStartParams(config=tools.to_config_dict())
Source code in src/codexed/models/tool_config.py
to_config_dict
¶
Serialize into a flat config dict for ThreadStartParams.config.
Only explicitly set tools are included. An empty BuiltinToolsConfig
produces an empty dict (server defaults preserved).
Source code in src/codexed/models/tool_config.py
to_tool_list
¶
to_tool_list() -> list[ToolConfig]
Return only explicitly set tool configs as a list.
Source code in src/codexed/models/tool_config.py
CodexClient
¶
Client for the Codex app-server JSON-RPC protocol.
Manages the subprocess lifecycle and provides async methods for: - Thread management (conversations) - Turn management (message exchanges) - Event streaming via notifications
Source code in src/codexed/client/client.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 | |
__aenter__
async
¶
Async context manager entry - starts the app-server.
Source code in src/codexed/client/client.py
__aexit__
async
¶
__init__
¶
__init__(
codex_command: str = "codex",
profile: str | None = None,
env_vars: dict[str, str] | None = None,
mcp_servers: Mapping[str, McpServerConfig] | None = None,
on_approval: ApprovalHandler | None = None,
on_user_input: UserInputHandler | None = None,
on_dynamic_tool_call: DynamicToolCallHandler | None = None,
on_mcp_elicitation: McpElicitationHandler | None = None,
mcp_elicitation_for_approvals: bool = False,
transport: Transport | None = None,
) -> None
Initialize the Codex app-server client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
codex_command
|
str
|
Path to the codex binary (default: "codex") |
'codex'
|
profile
|
str | None
|
Optional Codex profile to use |
None
|
env_vars
|
dict[str, str] | None
|
Optional environment variables to set for the Codex process. |
None
|
mcp_servers
|
Mapping[str, McpServerConfig] | None
|
Optional MCP servers to inject programmatically. Keys are server names, values are server configurations. |
None
|
on_approval
|
ApprovalHandler | None
|
Handler for all approval requests (command execution, file change, and skill approval). |
None
|
on_user_input
|
UserInputHandler | None
|
Handler for tool user input requests. |
None
|
on_dynamic_tool_call
|
DynamicToolCallHandler | None
|
Handler for dynamic tool call requests. |
None
|
on_mcp_elicitation
|
McpElicitationHandler | None
|
Handler for MCP elicitation requests. |
None
|
mcp_elicitation_for_approvals
|
bool
|
If True, enables the Codex
|
False
|
transport
|
Transport | None
|
Pre-configured transport instance. If provided,
|
None
|
Source code in src/codexed/client/client.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
add_event_listener
¶
add_event_listener(listener: EventListener) -> None
Receive events that belong to no running turn (account, config, app updates, ...).
Turn events go to the turn's stream; everything else is passed to the listeners (and otherwise dropped). Listeners run inside the read loop, in event order: they must return quickly and must not await client requests (that would deadlock).
Source code in src/codexed/client/client.py
apps_list
async
¶
apps_list(
*,
cursor: str | None = None,
limit: int | None = None,
thread_id: str | None = None,
force_refetch: bool | None = None,
) -> list[AppInfo]
List available apps/connectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cursor
|
str | None
|
Pagination cursor |
None
|
limit
|
int | None
|
Maximum number of apps to return |
None
|
thread_id
|
str | None
|
Optional thread ID for feature gating |
None
|
force_refetch
|
bool | None
|
Bypass caches and fetch latest |
None
|
Returns:
| Type | Description |
|---|---|
list[AppInfo]
|
List of AppInfo objects |
Source code in src/codexed/client/client.py
collaboration_mode_list
async
¶
collaboration_mode_list() -> list[CollaborationModeMask]
List available collaboration mode presets (experimental).
Returns:
| Type | Description |
|---|---|
list[CollaborationModeMask]
|
List of collaboration mode presets with name, mode, model, and effort |
Source code in src/codexed/client/client.py
command_exec
async
¶
command_exec(
command: list[str],
*,
cwd: str | None = None,
sandbox_policy: SandboxPolicy | None = None,
output_bytes_cap: int | None = None,
timeout_ms: int | None = None,
permission_profile: str | None = None,
) -> CommandExecResponse
Execute a command without creating a thread/turn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
list[str]
|
Command and arguments as list (e.g., ["ls", "-la"]) |
required |
cwd
|
str | None
|
Working directory for command |
None
|
sandbox_policy
|
SandboxPolicy | None
|
Sandbox policy override |
None
|
output_bytes_cap
|
int | None
|
Cap output based on bytes |
None
|
timeout_ms
|
int | None
|
Timeout in milliseconds |
None
|
permission_profile
|
str | None
|
Named permissions profile ID (cannot be combined with sandbox_policy) |
None
|
Returns:
| Type | Description |
|---|---|
CommandExecResponse
|
CommandExecResponse with exit_code, stdout, stderr |
Source code in src/codexed/client/client.py
config_batch_write
async
¶
config_batch_write(
edits: list[ConfigEdit], *, file_path: str | None = None, expected_version: str | None = None
) -> ConfigWriteResponse
Batch write config values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edits
|
list[ConfigEdit]
|
List of ConfigEdit objects |
required |
file_path
|
str | None
|
Optional config file path |
None
|
expected_version
|
str | None
|
Optional expected version for optimistic locking |
None
|
Returns:
| Type | Description |
|---|---|
ConfigWriteResponse
|
ConfigWriteResponse with status |
Source code in src/codexed/client/client.py
config_read
async
¶
Read configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_layers
|
bool
|
Whether to include config layer details |
False
|
cwd
|
str | None
|
Optional working directory for project config resolution |
None
|
Returns:
| Type | Description |
|---|---|
ConfigReadResponse
|
ConfigReadResponse with config data |
Source code in src/codexed/client/client.py
config_requirements_read
async
¶
config_requirements_read() -> ConfigRequirements | None
Read config requirements.
Source code in src/codexed/client/client.py
config_value_write
async
¶
config_value_write(
key_path: str,
value: Any,
merge_strategy: MergeStrategy,
*,
file_path: str | None = None,
expected_version: str | None = None,
) -> ConfigWriteResponse
Write a config value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_path
|
str
|
Dotted key path (e.g., "model") |
required |
value
|
Any
|
Value to write |
required |
merge_strategy
|
MergeStrategy
|
How to merge (replace or merge) |
required |
file_path
|
str | None
|
Optional config file path |
None
|
expected_version
|
str | None
|
Optional expected version for optimistic locking |
None
|
Returns:
| Type | Description |
|---|---|
ConfigWriteResponse
|
ConfigWriteResponse with status |
Source code in src/codexed/client/client.py
experimental_feature_list
async
¶
experimental_feature_list(
*, cursor: str | None = None, limit: int | None = None
) -> list[ExperimentalFeature]
List experimental features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cursor
|
str | None
|
Pagination cursor |
None
|
limit
|
int | None
|
Maximum number of features to return |
None
|
Returns:
| Type | Description |
|---|---|
list[ExperimentalFeature]
|
List of ExperimentalFeature objects |
Source code in src/codexed/client/client.py
external_agent_config_detect
async
¶
external_agent_config_detect(
*, include_home: bool | None = None, cwds: list[str] | None = None
) -> list[ExternalAgentConfigMigrationItem]
Detect external agent configurations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_home
|
bool | None
|
Include detection under user's home directory |
None
|
cwds
|
list[str] | None
|
Working directories for repo-scoped detection |
None
|
Returns:
| Type | Description |
|---|---|
list[ExternalAgentConfigMigrationItem]
|
ExternalAgentConfigDetectResponse with migration items |
Source code in src/codexed/client/client.py
external_agent_config_import
async
¶
external_agent_config_import(migration_items: list[ExternalAgentConfigMigrationItem]) -> None
Import external agent configurations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
migration_items
|
list[ExternalAgentConfigMigrationItem]
|
List of migration items to import |
required |
Source code in src/codexed/client/client.py
feedback_upload
async
¶
feedback_upload(
classification: str,
*,
reason: str | None = None,
thread_id: str | None = None,
tags: dict[str, Any] | None = None,
include_logs: bool = False,
extra_log_files: list[str] | None = None,
) -> str
Upload feedback.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
classification
|
str
|
Feedback classification |
required |
reason
|
str | None
|
Optional reason text |
None
|
thread_id
|
str | None
|
Optional thread ID to associate |
None
|
tags
|
dict[str, Any] | None
|
Optional tags to associate with the feedback |
None
|
include_logs
|
bool
|
Whether to include logs |
False
|
extra_log_files
|
list[str] | None
|
Additional log files to include |
None
|
Returns:
| Type | Description |
|---|---|
str
|
thread ID |
Source code in src/codexed/client/client.py
mcp_server_oauth_login
async
¶
mcp_server_oauth_login(
name: str, *, scopes: list[str] | None = None, timeout_secs: int | None = None
) -> str
Start OAuth login for an MCP server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the MCP server |
required |
scopes
|
list[str] | None
|
Optional OAuth scopes to request |
None
|
timeout_secs
|
int | None
|
Optional timeout in seconds |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Authorization URL |
Source code in src/codexed/client/client.py
mcp_server_refresh
async
¶
mcp_server_status_list
async
¶
mcp_server_status_list(
*,
detail: McpServerStatusDetail | None = None,
cursor: str | None = None,
limit: int | None = None,
) -> ListMcpServerStatusResponse
List MCP server status with tool and resource information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
detail
|
McpServerStatusDetail | None
|
Level of detail to include in the response |
None
|
cursor
|
str | None
|
Pagination cursor from previous call |
None
|
limit
|
int | None
|
Maximum number of servers to return |
None
|
Returns:
| Type | Description |
|---|---|
ListMcpServerStatusResponse
|
Response with server status entries and optional next_cursor |
Source code in src/codexed/client/client.py
model_list
async
¶
model_list(
*, include_hidden: bool | None = None, cursor: str | None = None, limit: int | None = None
) -> ModelListResponse
List available models with reasoning effort options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_hidden
|
bool | None
|
When true, include hidden models |
None
|
cursor
|
str | None
|
Opaque pagination cursor from previous response |
None
|
limit
|
int | None
|
Maximum number of models to return |
None
|
Returns:
| Type | Description |
|---|---|
ModelListResponse
|
ModelListResponse with data (list of models) and next_cursor |
Source code in src/codexed/client/client.py
read_resource
async
¶
Read a resource from the MCP server.
Source code in src/codexed/client/client.py
register_handler
¶
Register a handler for a server request method.
The handler receives the parsed params model and must return the appropriate response model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
HandlerMethod
|
Server request method name (use SERVER_REQUEST_* constants) |
required |
handler
|
ServerRequestHandler
|
Async callback that processes the request and returns a response |
required |
Source code in src/codexed/client/client.py
remove_event_listener
¶
remove_event_listener(listener: EventListener) -> None
Stop passing events to a listener added with :meth:add_event_listener.
reset_memory
async
¶
set_auto_approve
¶
Register default handlers that auto-approve all server requests.
Convenience method for non-interactive use cases where all approvals should be automatically granted and tool calls return empty results.
Source code in src/codexed/client/client.py
thread_fork
async
¶
thread_fork(
thread_id: str,
*,
path: str | None = None,
cwd: str | None = None,
model: str | None = None,
model_provider: str | None = None,
base_instructions: str | None = None,
developer_instructions: str | None = None,
approval_policy: AskForApproval | None = None,
approvals_reviewer: ApprovalsReviewer | None = None,
sandbox: SandboxMode | None = None,
config: dict[str, Any] | None = None,
tools: list[ToolConfig] | None = None,
code_mode: bool | None = None,
service_tier: str | None = None,
ephemeral: bool | None = None,
mcp_servers: Mapping[str, McpServerConfig] | None = None,
last_turn_id: str | None = None,
before_turn_id: str | None = None,
exclude_turns: bool | None = None,
permissions: str | None = None,
) -> Session
Fork an existing thread into a new thread with copied history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
thread_id
|
str
|
ID of the thread to fork |
required |
path
|
str | None
|
Path to thread storage |
None
|
cwd
|
str | None
|
Working directory for the forked thread |
None
|
model
|
str | None
|
Model override for forked thread |
None
|
model_provider
|
str | None
|
Model provider override |
None
|
base_instructions
|
str | None
|
Base system instructions for forked thread |
None
|
developer_instructions
|
str | None
|
Developer instructions for forked thread |
None
|
approval_policy
|
AskForApproval | None
|
Tool approval policy for forked thread |
None
|
approvals_reviewer
|
ApprovalsReviewer | None
|
Where approval requests are routed for review |
None
|
sandbox
|
SandboxMode | None
|
Sandbox mode for forked thread |
None
|
config
|
dict[str, Any] | None
|
Additional configuration overrides |
None
|
tools
|
list[ToolConfig] | None
|
Builtin tool configurations for forked thread |
None
|
code_mode
|
bool | None
|
Enable experimental code mode feature flag |
None
|
service_tier
|
str | None
|
Service tier |
None
|
personality
|
Personality for forked thread |
required | |
ephemeral
|
bool | None
|
If true, forked thread is not persisted |
None
|
mcp_servers
|
Mapping[str, McpServerConfig] | None
|
Per-thread MCP server configurations |
None
|
last_turn_id
|
str | None
|
Fork through this turn (inclusive), omitting later turns |
None
|
before_turn_id
|
str | None
|
Fork before this turn, excluding it and all later turns |
None
|
exclude_turns
|
bool | None
|
When true, return only thread metadata and live fork state
without populating |
None
|
permissions
|
str | None
|
Named permissions profile ID (cannot be combined with sandbox) |
None
|
Returns:
| Type | Description |
|---|---|
Session
|
Session wrapping the new forked thread |
Source code in src/codexed/client/client.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |
thread_list
async
¶
thread_list(
*,
cursor: str | None = None,
limit: int | None = None,
sort_key: ThreadSortKey | None = None,
model_providers: list[str] | None = None,
source_kinds: list[ThreadSourceKind] | None = None,
archived: bool | None = None,
cwd: ThreadListCwdFilter | None = None,
search_term: str | None = None,
sort_direction: SortDirection | None = None,
use_state_db_only: bool | None = None,
) -> ThreadListResponse
List stored threads with pagination.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cursor
|
str | None
|
Opaque pagination cursor from previous response |
None
|
limit
|
int | None
|
Maximum number of threads to return |
None
|
sort_key
|
ThreadSortKey | None
|
Sort key (created_at or updated_at) |
None
|
model_providers
|
list[str] | None
|
Filter by model providers |
None
|
source_kinds
|
list[ThreadSourceKind] | None
|
Filter by source kinds |
None
|
archived
|
bool | None
|
If true, only return archived threads |
None
|
cwd
|
ThreadListCwdFilter | None
|
Filter by working directory |
None
|
search_term
|
str | None
|
Substring filter for thread title |
None
|
sort_direction
|
SortDirection | None
|
Sort direction (asc or desc) |
None
|
use_state_db_only
|
bool | None
|
If true, only return threads from the state DB |
None
|
Returns:
| Type | Description |
|---|---|
ThreadListResponse
|
ThreadListResponse with data (list of threads) and next_cursor |
Source code in src/codexed/client/client.py
thread_loaded_list
async
¶
thread_loaded_list(
*, cursor: str | None = None, limit: int | None = None
) -> ThreadLoadedListResponse
List thread IDs currently loaded in memory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cursor
|
str | None
|
Opaque pagination cursor from previous response |
None
|
limit
|
int | None
|
Maximum number of thread IDs to return |
None
|
Returns:
| Type | Description |
|---|---|
ThreadLoadedListResponse
|
ThreadLoadedListResponse with data (list of thread IDs) and next_cursor |
Source code in src/codexed/client/client.py
thread_resume
async
¶
thread_resume(
thread_id: str,
*,
path: str | None = None,
cwd: str | None = None,
model: str | None = None,
model_provider: str | None = None,
base_instructions: str | None = None,
developer_instructions: str | None = None,
approval_policy: AskForApproval | None = None,
approvals_reviewer: ApprovalsReviewer | None = None,
sandbox: SandboxMode | None = None,
config: dict[str, Any] | None = None,
tools: list[ToolConfig] | None = None,
code_mode: bool | None = None,
service_tier: str | None = None,
personality: Personality | None = None,
mcp_servers: Mapping[str, McpServerConfig] | None = None,
exclude_turns: bool | None = None,
permissions: str | None = None,
) -> Session
Resume an existing thread by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
thread_id
|
str
|
ID of the thread to resume |
required |
path
|
str | None
|
Path to thread storage |
None
|
cwd
|
str | None
|
Working directory override |
None
|
model
|
str | None
|
Model override |
None
|
model_provider
|
str | None
|
Model provider override |
None
|
base_instructions
|
str | None
|
Base system instructions override |
None
|
developer_instructions
|
str | None
|
Developer instructions override |
None
|
approval_policy
|
AskForApproval | None
|
Tool approval policy override |
None
|
approvals_reviewer
|
ApprovalsReviewer | None
|
Where approval requests are routed for review |
None
|
sandbox
|
SandboxMode | None
|
Sandbox mode override |
None
|
config
|
dict[str, Any] | None
|
Additional configuration overrides |
None
|
tools
|
list[ToolConfig] | None
|
Builtin tool configurations override |
None
|
code_mode
|
bool | None
|
Enable experimental code mode feature flag |
None
|
service_tier
|
str | None
|
Service tier |
None
|
personality
|
Personality | None
|
Personality override |
None
|
mcp_servers
|
Mapping[str, McpServerConfig] | None
|
Per-thread MCP server configurations |
None
|
exclude_turns
|
bool | None
|
If true, exclude turns from the thread's history |
None
|
permissions
|
str | None
|
Named permissions profile ID (cannot be combined with sandbox) |
None
|
Returns:
| Type | Description |
|---|---|
Session
|
Session wrapping the resumed thread |
Source code in src/codexed/client/client.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | |
thread_start
async
¶
thread_start(
*,
cwd: str | None = None,
model: str | None = None,
model_provider: str | None = None,
base_instructions: str | None = None,
developer_instructions: str | None = None,
approval_policy: AskForApproval | None = None,
approvals_reviewer: ApprovalsReviewer | None = None,
sandbox: SandboxMode | None = None,
config: dict[str, Any] | None = None,
tools: list[ToolConfig] | None = None,
code_mode: bool | None = None,
service_name: str | None = None,
service_tier: str | None = None,
personality: Personality | None = None,
ephemeral: bool | None = None,
dynamic_tools: list[DynamicToolSpec] | None = None,
mcp_servers: Mapping[str, McpServerConfig] | None = None,
experimental_raw_events: bool = False,
session_start_source: ThreadStartSource | None = None,
environments: list[TurnEnvironmentParams] | None = None,
) -> Session
Start a new conversation thread.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cwd
|
str | None
|
Working directory for the thread |
None
|
model
|
str | None
|
Model to use (e.g., "gpt-5-codex") |
None
|
model_provider
|
str | None
|
Model provider (e.g., "openai", "anthropic") |
None
|
base_instructions
|
str | None
|
Base system instructions for the thread |
None
|
developer_instructions
|
str | None
|
Developer-provided instructions |
None
|
approval_policy
|
AskForApproval | None
|
Tool approval policy |
None
|
approvals_reviewer
|
ApprovalsReviewer | None
|
Where approval requests are routed for review |
None
|
sandbox
|
SandboxMode | None
|
Sandbox mode for file operations |
None
|
config
|
dict[str, Any] | None
|
Additional configuration overrides |
None
|
tools
|
list[ToolConfig] | None
|
Builtin tool configurations. |
None
|
code_mode
|
bool | None
|
Enable experimental code mode feature flag |
None
|
service_name
|
str | None
|
Optional service name |
None
|
service_tier
|
str | None
|
Service tier |
None
|
personality
|
Personality | None
|
Personality preset (none, friendly, pragmatic) |
None
|
ephemeral
|
bool | None
|
If true, thread is not persisted to disk |
None
|
dynamic_tools
|
list[DynamicToolSpec] | None
|
Dynamic tool specifications |
None
|
mcp_servers
|
Mapping[str, McpServerConfig] | None
|
Per-thread MCP server configurations.
Merged into |
None
|
experimental_raw_events
|
bool
|
Emit raw Responses API items (internal) |
False
|
session_start_source
|
ThreadStartSource | None
|
Source of the session start |
None
|
environments
|
list[TurnEnvironmentParams] | None
|
List of environment variables to set for the thread |
None
|
Returns:
| Type | Description |
|---|---|
Session
|
Session wrapping the new thread |
Source code in src/codexed/client/client.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
warning
async
¶
CodexError
¶
CodexProcessError
¶
Bases: CodexError
Error starting or communicating with the Codex app-server process.
CodexRequestError
¶
Bases: CodexError
Error from a Codex app-server request (JSON-RPC error response).
Source code in src/codexed/exceptions.py
CollaborationMode
¶
CommandExecResponse
¶
Bases: CodexBaseModel
Final buffered result for command/exec.
Source code in src/codexed/models/v2_protocol.py
ConfigWarningMessage
¶
Bases: CodexBaseModel
Notification sent from the server to the client.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
ConfigWarningNotification
¶
Bases: CodexBaseModel
Source code in src/codexed/models/v2_protocol.py
ExperimentalFeature
¶
Bases: CodexBaseModel
Source code in src/codexed/models/v2_protocol.py
announcement
class-attribute
instance-attribute
¶
Announcement copy shown to users when the feature is introduced. Null when this feature is not in beta.
default_enabled
instance-attribute
¶
Whether this feature is enabled by default.
description
class-attribute
instance-attribute
¶
Short summary describing what the feature does. Null when this feature is not in beta.
display_name
class-attribute
instance-attribute
¶
User-facing display name shown in the experimental features UI. Null when this feature is not in beta.
enabled
instance-attribute
¶
Whether this feature is currently enabled in the loaded config.
FsChangedMessage
¶
Bases: CodexBaseModel
Notification sent from the server to the client.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
HttpMcpServer
¶
Bases: BaseModel
MCP server accessible via HTTP/SSE transport.
Source code in src/codexed/models/mcp_server.py
default_tools_approval_mode
class-attribute
instance-attribute
¶
default_tools_approval_mode: ToolApprovalMode | None = None
When Codex asks before calling this server's tools (Codex's default: auto).
InternalRpcError
¶
InvalidParamsError
¶
InvalidRequestError
¶
Bases: CodexRequestError
JSON-RPC invalid request (-32600).
Source code in src/codexed/exceptions.py
ItemAgentMessageDeltaNotification
¶
Bases: CodexBaseModel
Notification sent from the server to the client.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
ItemCommandExecutionOutputDeltaNotification
¶
Bases: CodexBaseModel
Notification sent from the server to the client.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
ItemCompletedEvent
¶
ItemFileChangeOutputDeltaNotification
¶
Bases: CodexBaseModel
Deprecated legacy apply_patch output stream notification.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
ItemPlanDeltaNotification
¶
Bases: CodexBaseModel
EXPERIMENTAL - proposed plan streaming deltas for plan items.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
ItemReasoningTextDeltaNotification
¶
Bases: CodexBaseModel
Notification sent from the server to the client.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
ItemStartedEvent
¶
MethodNotFoundError
¶
Bases: CodexRequestError
JSON-RPC method not found (-32601).
Source code in src/codexed/exceptions.py
Model
¶
Bases: CodexBaseModel
Source code in src/codexed/models/v2_protocol.py
additional_speed_tiers
class-attribute
instance-attribute
¶
Deprecated: use serviceTiers instead.
available_access_programs
class-attribute
instance-attribute
¶
available_access_programs: ModelAccessPrograms | None = None
Null when the catalog does not provide access-program metadata.
default_service_tier
class-attribute
instance-attribute
¶
Catalog default service tier id for this model, when one is configured.
multi_agent_version
class-attribute
instance-attribute
¶
multi_agent_version: MultiAgentVersion | None = None
Multi-agent runtime declared by this model, when available.
supports_personality
class-attribute
instance-attribute
¶
@deprecated Always false; models no longer support personality selection.
ModelReroutedMessage
¶
Bases: CodexBaseModel
Notification sent from the server to the client.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
ParseError
¶
PlanDeltaNotification
¶
Bases: CodexBaseModel
EXPERIMENTAL - proposed plan streaming deltas for plan items. Clients should not assume concatenated deltas match the completed plan item content.
Source code in src/codexed/models/v2_protocol.py
RetryLimitExceededError
¶
Bases: ServerBusyError
Server exhausted internal retry budget for a retryable operation.
Source code in src/codexed/exceptions.py
ReviewStartResponse
¶
ServerBusyError
¶
Bases: CodexRequestError
Server is overloaded / unavailable and caller should retry.
Source code in src/codexed/exceptions.py
Session
¶
Runtime handle for an active Codex thread.
Wraps a :class:CodexClient and a thread_id so that every
thread-scoped operation can be called without passing the ID again.
Returned by :meth:CodexClient.thread_start,
:meth:CodexClient.thread_resume, and :meth:CodexClient.thread_fork.
Example::
session = await client.thread_start(cwd="/my/project")
async for event in session.turn_stream("Explain this repo"):
...
await session.set_name("exploration")
Source code in src/codexed/client/session.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | |
approve_guardian_denied_action
async
¶
Send a request to the server to approve a guardian denied action.
Source code in src/codexed/client/session.py
archive
async
¶
Archive this thread.
compact_start
async
¶
Trigger context compaction for this thread.
fork
async
¶
fork(
*,
path: str | None = None,
cwd: str | None = None,
model: str | None = None,
model_provider: str | None = None,
base_instructions: str | None = None,
developer_instructions: str | None = None,
approval_policy: AskForApproval | None = None,
approvals_reviewer: ApprovalsReviewer | None = None,
sandbox: SandboxMode | None = None,
config: dict[str, Any] | None = None,
tools: list[ToolConfig] | None = None,
code_mode: bool | None = None,
service_tier: str | None = None,
ephemeral: bool | None = None,
mcp_servers: Mapping[str, McpServerConfig] | None = None,
last_turn_id: str | None = None,
before_turn_id: str | None = None,
exclude_turns: bool | None = None,
permissions: str | None = None,
) -> Session
Fork this thread into a new thread with copied history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | None
|
Path to thread storage |
None
|
cwd
|
str | None
|
Working directory for the forked thread |
None
|
model
|
str | None
|
Model override for forked thread |
None
|
model_provider
|
str | None
|
Model provider override |
None
|
base_instructions
|
str | None
|
Base system instructions for forked thread |
None
|
developer_instructions
|
str | None
|
Developer instructions for forked thread |
None
|
approval_policy
|
AskForApproval | None
|
Tool approval policy for forked thread |
None
|
approvals_reviewer
|
ApprovalsReviewer | None
|
Where approval requests are routed for review |
None
|
sandbox
|
SandboxMode | None
|
Sandbox mode for forked thread |
None
|
config
|
dict[str, Any] | None
|
Additional configuration overrides |
None
|
tools
|
list[ToolConfig] | None
|
Builtin tool configurations for forked thread |
None
|
code_mode
|
bool | None
|
Enable experimental code mode feature flag |
None
|
service_tier
|
str | None
|
Service tier |
None
|
ephemeral
|
bool | None
|
If true, forked thread is not persisted |
None
|
mcp_servers
|
Mapping[str, McpServerConfig] | None
|
Per-thread MCP server configurations |
None
|
last_turn_id
|
str | None
|
Fork through this turn (inclusive), omitting later turns |
None
|
before_turn_id
|
str | None
|
Fork before this turn, excluding it and all later turns |
None
|
exclude_turns
|
bool | None
|
When true, return only thread metadata and live fork state
without populating |
None
|
permissions
|
str | None
|
Named permissions profile ID (cannot be combined with sandbox) |
None
|
Returns:
| Type | Description |
|---|---|
Session
|
Session wrapping the new forked thread |
Source code in src/codexed/client/session.py
guardian_warning
async
¶
Send a thread-related guardian warning message to the app-server.
Source code in src/codexed/client/session.py
inject_items
async
¶
Inject raw responses-API Items into the thread's model-visible history.
Source code in src/codexed/client/session.py
list_turns
async
¶
list_turns(
cursor: str | None = None, limit: int | None = None, sort_direction: SortDirection | None = None
) -> ThreadTurnsListResponse
List all turns in this thread.
Source code in src/codexed/client/session.py
read
async
¶
read(*, include_turns: bool = False) -> ThreadReadResponse
Read thread data.
Source code in src/codexed/client/session.py
read_resource
async
¶
Read a resource from the MCP server.
Source code in src/codexed/client/session.py
realtime
¶
realtime(
output_modality: RealtimeOutputModality,
prompt: str | None = None,
*,
realtime_session_id: str | None = None,
) -> RealtimeSession
Open a realtime voice session on this thread.
Returns an async context manager that sends thread/realtime/start
on enter and thread/realtime/stop on exit. Iterate over the
returned object to receive realtime events.
Example::
async with session.realtime(prompt="You are helpful") as rt:
await rt.send_text("hello")
async for event in rt:
...
Source code in src/codexed/client/session.py
revert
async
¶
revert(before_turn_id: str) -> ThreadRevertResponse
Replace the thread's persisted history with the turns before before_turn_id.
The given turn and all later turns are dropped. Only conversation history changes; local file changes are not reverted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
before_turn_id
|
str
|
First turn to drop (it and every later turn are removed) |
required |
Returns:
| Type | Description |
|---|---|
ThreadRevertResponse
|
Updated thread metadata and cursors for re-hydrating the retained history |
Source code in src/codexed/client/session.py
review_start
async
¶
review_start(target: ReviewTarget, *, delivery: ReviewDelivery = 'inline') -> ReviewStartResponse
Start a code review.
Inline delivery runs the review on the same thread, so review items appear in the existing thread history. Detached delivery creates a new thread for the review, keeping the original thread's history clean.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
ReviewTarget
|
Review target (uncommittedChanges, baseBranch, commit, or custom) |
required |
delivery
|
ReviewDelivery
|
Where to run the review (inline or detached) |
'inline'
|
Returns:
| Type | Description |
|---|---|
ReviewStartResponse
|
ReviewStartResponse with turn and review thread ID |
Source code in src/codexed/client/session.py
review_stream
async
¶
review_stream(
target: ReviewTarget, *, delivery: ReviewDelivery = "inline"
) -> AsyncIterator[CodexEvent]
Start a code review and stream events.
Inline delivery runs the review on the same thread, so review items appear in the existing thread history. Detached delivery creates a new thread for the review, keeping the original thread's history clean.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
ReviewTarget
|
Review target (uncommittedChanges, baseBranch, commit, or custom) |
required |
delivery
|
ReviewDelivery
|
Where to run the review (inline or detached) |
'inline'
|
Yields:
| Name | Type | Description |
|---|---|---|
CodexEvent |
AsyncIterator[CodexEvent]
|
Streaming events from the review turn |
Cancelling the consumer, or closing the stream before the turn completes, interrupts the review turn.
Source code in src/codexed/client/session.py
set_memory_mode
async
¶
Set the thread's memory mode.
Source code in src/codexed/client/session.py
set_name
async
¶
Set a user-facing name for this thread.
shell_command
async
¶
Run a user-initiated shell command against this thread.
Executes the command unsandboxed, as if the user typed !command
in the Codex CLI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
Shell command to execute. |
required |
Source code in src/codexed/client/session.py
tool_call
async
¶
tool_call(
server: str, tool: str, arguments: Any | None = None, meta: dict[str, Any] | None = None
) -> CallToolResult
Call a tool on the MCP server.
Source code in src/codexed/client/session.py
turn_interrupt
async
¶
Interrupt a running turn.
turn_steer
async
¶
turn_steer(
user_input: str | Sequence[UserInput],
*,
expected_turn_id: str,
responsesapi_client_metadata: dict[str, Any] | None = None,
) -> TurnSteerResponse
Steer a running turn with additional input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_input
|
str | Sequence[UserInput]
|
Additional user input |
required |
expected_turn_id
|
str
|
The expected active turn ID (precondition) |
required |
responsesapi_client_metadata
|
dict[str, Any] | None
|
Optional turn-scoped Responses API client metadata. |
None
|
Returns:
| Type | Description |
|---|---|
TurnSteerResponse
|
TurnSteerResponse with the turn ID |
Source code in src/codexed/client/session.py
turn_stream
async
¶
turn_stream(
user_input: str | Sequence[UserInput],
*,
model: str | None = None,
effort: ReasoningEffort | None = None,
approval_policy: AskForApproval | None = None,
approvals_reviewer: ApprovalsReviewer | None = None,
cwd: str | None = None,
sandbox_policy: SandboxMode | SandboxPolicy | None = None,
output_schema: dict[str, Any] | type[Any] | None = None,
personality: Personality | None = None,
service_tier: str | None = None,
summary: ReasoningSummary | None = None,
collaboration_mode: CollaborationMode | None = None,
responsesapi_client_metadata: dict[str, Any] | None = None,
environments: list[TurnEnvironmentParams] | None = None,
permissions: str | None = None,
) -> AsyncIterator[CodexEvent]
Start a turn and stream events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_input
|
str | Sequence[UserInput]
|
User input as string or list of input items (text/image) |
required |
model
|
str | None
|
Optional model override for this turn |
None
|
effort
|
ReasoningEffort | None
|
Optional reasoning effort override |
None
|
approval_policy
|
AskForApproval | None
|
Optional approval policy |
None
|
approvals_reviewer
|
ApprovalsReviewer | None
|
Where approval requests are routed for review |
None
|
cwd
|
str | None
|
Optional working directory override for this and subsequent turns |
None
|
sandbox_policy
|
SandboxMode | SandboxPolicy | None
|
Optional sandbox mode or policy dict |
None
|
output_schema
|
dict[str, Any] | type[Any] | None
|
Optional JSON Schema dict or Pydantic type to constrain output |
None
|
personality
|
Personality | None
|
Optional personality override |
None
|
service_tier
|
str | None
|
Optional service tier (fast/flex) |
None
|
summary
|
ReasoningSummary | None
|
Optional reasoning summary mode |
None
|
collaboration_mode
|
CollaborationMode | None
|
Optional collaboration mode preset (experimental) |
None
|
responsesapi_client_metadata
|
dict[str, Any] | None
|
Optional turn-scoped Responses API client metadata. |
None
|
environments
|
list[TurnEnvironmentParams] | None
|
Optional list of environment variables to set for this turn. |
None
|
permissions
|
str | None
|
Named permissions profile ID (cannot be combined with sandbox) |
None
|
Yields:
| Name | Type | Description |
|---|---|---|
CodexEvent |
AsyncIterator[CodexEvent]
|
Streaming events from the turn |
Cancelling the consumer, or closing the stream before turn/completed,
interrupts the turn (turn/interrupt).
Source code in src/codexed/client/session.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
turn_stream_structured
async
¶
turn_stream_structured(
user_input: str | list[UserInput],
result_type: type[ResultType],
*,
model: str | None = None,
effort: ReasoningEffort | None = None,
approval_policy: AskForApproval | None = None,
approvals_reviewer: ApprovalsReviewer | None = None,
cwd: str | None = None,
sandbox_policy: SandboxMode | SandboxPolicy | None = None,
personality: Personality | None = None,
service_tier: str | None = None,
summary: ReasoningSummary | None = None,
collaboration_mode: CollaborationMode | None = None,
) -> ResultType
Start a turn with structured output and return the parsed result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_input
|
str | list[UserInput]
|
User input as string or list of items |
required |
result_type
|
type[ResultType]
|
Pydantic model class for the expected result |
required |
model
|
str | None
|
Optional model override for this turn |
None
|
effort
|
ReasoningEffort | None
|
Optional reasoning effort override |
None
|
approval_policy
|
AskForApproval | None
|
Optional approval policy |
None
|
approvals_reviewer
|
ApprovalsReviewer | None
|
Where approval requests are routed for review |
None
|
cwd
|
str | None
|
Optional working directory override |
None
|
sandbox_policy
|
SandboxMode | SandboxPolicy | None
|
Optional sandbox mode or policy dict |
None
|
personality
|
Personality | None
|
Optional personality override |
None
|
service_tier
|
str | None
|
Optional service tier (fast/flex) |
None
|
summary
|
ReasoningSummary | None
|
Optional reasoning summary mode |
None
|
collaboration_mode
|
CollaborationMode | None
|
Optional collaboration mode preset (experimental) |
None
|
Returns:
| Type | Description |
|---|---|
ResultType
|
Parsed Pydantic model instance of type result_type |
Source code in src/codexed/client/session.py
unarchive
async
¶
unarchive() -> ThreadUnarchiveResponse
Unarchive this thread.
Source code in src/codexed/client/session.py
unsubscribe
async
¶
Stop listening to this thread's events.
Source code in src/codexed/client/session.py
warning
async
¶
Send a thread-related warning message to the app-server.
Source code in src/codexed/client/session.py
Settings
¶
Bases: CodexBaseModel
Settings for a collaboration mode.
Source code in src/codexed/models/v2_protocol.py
SkillMetadata
¶
Bases: CodexBaseModel
Source code in src/codexed/models/v2_protocol.py
StdioMcpServer
¶
Bases: BaseModel
MCP server running as a subprocess via stdio transport.
Source code in src/codexed/models/mcp_server.py
default_tools_approval_mode
class-attribute
instance-attribute
¶
default_tools_approval_mode: ToolApprovalMode | None = None
When Codex asks before calling this server's tools (Codex's default: auto).
StdioTransport
¶
Transport that communicates with a Codex app-server subprocess via stdin/stdout.
Source code in src/codexed/transport.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
close_reason
async
¶
Describe why the server's stdout closed: exit code and the last stderr lines.
Source code in src/codexed/transport.py
TextUserInput
¶
Bases: CodexBaseModel
Source code in src/codexed/models/v2_protocol.py
text_elements
class-attribute
instance-attribute
¶
text_elements: list[TextElement] | None = Field([], validate_default=True)
UI-defined spans within text used to render or persist special elements.
Thread
¶
Bases: CodexBaseModel
Source code in src/codexed/models/misc.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
agent_nickname
class-attribute
instance-attribute
¶
Optional random unique nickname assigned to an AgentControl-spawned sub-agent.
agent_role
class-attribute
instance-attribute
¶
Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.
created_at
instance-attribute
¶
Unix timestamp (in seconds) when the thread was created.
ephemeral
instance-attribute
¶
Whether the thread is ephemeral and should not be materialized on disk.
forked_from_id
class-attribute
instance-attribute
¶
Source thread id when this thread was created by forking another thread.
git_info
class-attribute
instance-attribute
¶
Optional Git metadata captured when the thread was created.
model_provider
instance-attribute
¶
Model provider used for this thread (for example, 'openai').
name
class-attribute
instance-attribute
¶
Optional user-facing thread title.
path
class-attribute
instance-attribute
¶
[UNSTABLE] Path to the thread on disk.
preview
instance-attribute
¶
Usually the first user message in the thread, if available.
recency_at
class-attribute
instance-attribute
¶
Unix timestamp (in seconds) used to order threads by recency.
source
instance-attribute
¶
Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).
turns
instance-attribute
¶
turns: list[Turn]
Only populated on thread/resume, thread/fork, and thread/read
(when includeTurns is true) responses.
For all other responses and notifications returning a Thread,
the turns field will be an empty list.
updated_at
instance-attribute
¶
Unix timestamp (in seconds) when the thread was last updated.
ThreadArchivedMessage
¶
Bases: CodexBaseModel
Notification sent from the server to the client.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
ThreadCompactedMessage
¶
Bases: CodexBaseModel
Deprecated: Use ContextCompaction item type instead.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
ThreadListResponse
¶
Bases: CodexBaseModel
Response for thread/list request.
Source code in src/codexed/models/responses.py
read_states
class-attribute
instance-attribute
¶
read_states: dict[str, ThreadReadState] | None = None
Read state per thread ID.
ThreadNameUpdatedMessage
¶
Bases: CodexBaseModel
Notification sent from the server to the client.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
ThreadReadResponse
¶
ThreadResponse
¶
Bases: CodexBaseModel
Response for thread/start, thread/resume, and thread/fork.
Source code in src/codexed/models/responses.py
collaboration_mode
class-attribute
instance-attribute
¶
collaboration_mode: CollaborationMode | None = None
Only returned by thread/resume.
initial_turns_page
class-attribute
instance-attribute
¶
initial_turns_page: TurnsPage | None = None
Only returned by thread/resume.
items_backwards_cursor
class-attribute
instance-attribute
¶
Only returned by thread/resume.
turns_backwards_cursor
class-attribute
instance-attribute
¶
Only returned by thread/resume.
ThreadRevertResponse
¶
Bases: CodexBaseModel
Response for thread/revert request.
Source code in src/codexed/models/responses.py
items_backwards_cursor
class-attribute
instance-attribute
¶
Cursor for hydrating paginated items backwards via thread/items/list.
thread
instance-attribute
¶
thread: Thread
Updated thread metadata. turns is always empty; use thread/turns/list.
turns_backwards_cursor
class-attribute
instance-attribute
¶
Cursor for hydrating paginated turns backwards via thread/turns/list.
ThreadStartedData
¶
Bases: CodexBaseModel
Payload for thread/started notification (V2 protocol).
Source code in src/codexed/models/event_data.py
ThreadStartedEvent
¶
ThreadStatusChangedMessage
¶
Bases: CodexBaseModel
Notification sent from the server to the client.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
ThreadUnarchiveResponse
¶
Bases: CodexBaseModel
Response for thread/unarchive request.
Source code in src/codexed/models/responses.py
ThreadUnarchivedMessage
¶
Bases: CodexBaseModel
Notification sent from the server to the client.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
TransportClosedError
¶
Bases: CodexProcessError
Raised when the app-server transport closes unexpectedly.
TurnCompletedData
¶
TurnCompletedEvent
¶
TurnFailedError
¶
Bases: CodexError
Raised when a turn completes with failed status.
Source code in src/codexed/exceptions.py
TurnPlanUpdatedMessage
¶
Bases: CodexBaseModel
Notification sent from the server to the client.
Source code in src/codexed/models/v2_protocol.py
emitted_at_ms
class-attribute
instance-attribute
¶
Unix timestamp (in milliseconds) when app-server emitted this notification.
TurnStartedData
¶
TurnStartedEvent
¶
WebSocketTransport
¶
Transport that connects to a remote Codex app-server via WebSocket.
Requires the websockets package (pip install codexed[websocket]).
Source code in src/codexed/transport.py
is_retryable_error
¶
Check if an exception is a transient overload-style error worth retrying.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exc
|
BaseException
|
The exception to check. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the error is transient and the operation should be retried. |
Source code in src/codexed/exceptions.py
tools_to_config_dict
¶
tools_to_config_dict(tools: list[ToolConfig]) -> dict[str, Any]
Convert a list of tool configs into the config dict for ThreadStartParams.
Each tool config contributes its settings to the appropriate config keys. An empty list explicitly disables all builtin tools.
Example::
config = tools_to_config_dict([]) # disable all tools
config = tools_to_config_dict([ # enable only these
WebSearchToolConfig(mode="live", context_size="high"),
JsReplToolConfig(),
])
Source code in src/codexed/models/tool_config.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | |