Expand description
Defines the protocol for a Codex session between a client and an agent.
Uses a SQ (Submission Queue) / EQ (Event Queue) pattern to asynchronously communicate between user and agent.
Re-exports§
pub use crate::approvals::ApplyPatchApprovalRequestEvent;pub use crate::approvals::ElicitationAction;pub use crate::approvals::ExecApprovalRequestEvent;pub use crate::approvals::ExecPolicyAmendment;pub use crate::approvals::GuardianAssessmentAction;pub use crate::approvals::GuardianAssessmentDecisionSource;pub use crate::approvals::GuardianAssessmentEvent;pub use crate::approvals::GuardianAssessmentOutcome;pub use crate::approvals::GuardianAssessmentStatus;pub use crate::approvals::GuardianCommandSource;pub use crate::approvals::GuardianRiskLevel;pub use crate::approvals::GuardianUserAuthorization;pub use crate::approvals::NetworkApprovalContext;pub use crate::approvals::NetworkApprovalProtocol;pub use crate::approvals::NetworkPolicyAmendment;pub use crate::approvals::NetworkPolicyRuleAction;pub use crate::permissions::FileSystemAccessMode;pub use crate::permissions::FileSystemPath;pub use crate::permissions::FileSystemSandboxEntry;pub use crate::permissions::FileSystemSandboxKind;pub use crate::permissions::FileSystemSandboxPolicy;pub use crate::permissions::FileSystemSpecialPath;pub use crate::permissions::NetworkSandboxPolicy;pub use crate::request_permissions::RequestPermissionsArgs;pub use crate::request_user_input::RequestUserInputEvent;
Structs§
- Additional
Context Entry - Client-supplied context keyed by an opaque source identifier.
- Agent
Message Content Delta Event - Agent
Message Event - Agent
Reasoning Event - Agent
Reasoning RawContent Event - Agent
Reasoning Section Break Event - Chunk
- Collab
Agent Interaction Begin Event - Collab
Agent Interaction EndEvent - Collab
Agent Ref - Collab
Agent Spawn Begin Event - Collab
Agent Spawn EndEvent - Collab
Agent Status Entry - Collab
Close Begin Event - Collab
Close EndEvent - Collab
Resume Begin Event - Collab
Resume EndEvent - Collab
Waiting Begin Event - Collab
Waiting EndEvent - Compacted
Item - Context
Compacted Event - Conversation
Audio Params - Conversation
Path Response Event - Response payload for
Op::GetHistorycontaining the current session’s in-memory transcript. - Conversation
Speech Params - Conversation
Start Params - Conversation
Text Params - Credits
Snapshot - Deprecation
Notice Event - Dynamic
Tool Call Response Event - Entered
Review Mode Event - Environment
Connection Event - Error
Event - Event
- Event Queue Entry - events from agent
- Exec
Command Begin Event - Exec
Command EndEvent - Exec
Command Output Delta Event - Exited
Review Mode Event - Final
Output - GitInfo
- GitSha
- Granular
Approval Config - History
Position - Exclusive position in another thread’s paginated rollout history.
- Hook
Completed Event - Hook
Event Name Iter - An iterator over the variants of HookEventName
- Hook
Output Entry - Hook
RunSummary - Hook
Started Event - Image
Generation Begin Event - Image
Generation EndEvent - Inter
Agent Communication - Item
Completed Event - Item
Started Event - McpInvocation
- McpServer
Refresh Config - Config payload for refreshing MCP servers.
- McpStartup
Complete Event - McpStartup
Failure - McpStartup
Update Event - McpTool
Call Begin Event - McpTool
Call EndEvent - Model
Reroute Event - Model
Verification Event - Patch
Apply Begin Event - Patch
Apply EndEvent - Patch
Apply Updated Event - Plan
Delta Event - Rate
Limit Snapshot - Rate
Limit Window - RawResponse
Completed Event - Exact usage reported by one upstream Responses API completion.
- RawResponse
Item Event - Realtime
Audio Frame - Realtime
Conversation Closed Event - Realtime
Conversation List Voices Response Event - Realtime
Conversation Realtime Event - Realtime
Conversation SdpEvent - Realtime
Conversation Started Event - Realtime
Handoff Requested - Realtime
Input Audio Speech Started - Realtime
Noop Requested - Realtime
Response Cancelled - Realtime
Response Created - Realtime
Response Done - Realtime
Transcript Delta - Realtime
Transcript Done - Realtime
Transcript Entry - Realtime
Voices List - Reasoning
Content Delta Event - Reasoning
RawContent Delta Event - Resumed
History - Review
Code Location - Location of the code related to a review finding.
- Review
Finding - A single review finding describing an observed issue or recommendation.
- Review
Line Range - Inclusive line range in a file associated with the finding.
- Review
Output Event - Structured review result produced by a child review session.
- Review
Request - Review request sent to the review session.
- Rollout
Line - Safety
Buffering Event - Session
Configured Event - Session
Context Window - Session
Meta - SessionMeta contains session-level data that doesn’t correspond to a specific turn.
- Session
Meta Line - Session
Network Proxy Runtime - Skill
Dependencies - Skill
Interface - Skill
Metadata - Skill
Tool Dependency - Spend
Control Limit Snapshot - Stream
Error Event - Stream
Info Event - SubAgent
Activity Event - Submission
- Submission Queue Entry - requests from user
- Terminal
Interaction Event - Thread
Goal - Thread
Goal Updated Event - Thread
Rolled Back Event - Thread
Settings Applied Event - Thread
Settings Overrides - Persistent thread-settings overrides that can be applied before user input or on their own.
- Thread
Settings Snapshot - Token
Count Event - Token
Usage - Token
Usage Info - Turn
Aborted Event - Turn
Complete Event - Turn
Context Item - Persist once per real user turn after computing that turn’s model-visible context updates, and again after mid-turn compaction when replacement history re-establishes full context, so resume/fork replay can recover the latest durable baseline.
- Turn
Context Network Item - Turn
Diff Event - Turn
Environment Selection - Turn
Environment Selections - Turn
Moderation Metadata Event - Turn
Started Event - User
Message Event - View
Image Tool Call Event - W3cTrace
Context - Warning
Event - WebSearch
Begin Event - WebSearch
EndEvent - World
State Item - Persisted comparison state used to resume model-visible world-state diffing.
- Writable
Root - A writable root path accompanied by a list of subpaths that should remain
read‑only even when the root is writable. This is primarily used to ensure
that folders containing files that could be modified to escalate the
privileges of the agent (e.g.
.codex,.git, notably.git/hooks) under a writable root are not modified by the agent.
Enums§
- Additional
Context Kind - Source classification for client-supplied context.
- Agent
Status - Agent lifecycle status, derived from emitted events.
- AskFor
Approval - Determines the conditions under which the user is consulted to approve running the command proposed by Codex.
- Codex
Error Info - Codex errors that we expose to clients.
- Codex
Response Handoff Mode - Conversation
Start Transport - Conversation
Text Role - Event
Msg - Response event from the agent NOTE: Make sure none of these values have optional types, as it will mess up the extension code-gen.
- Exec
Command Source - Exec
Command Status - Exec
Output Stream - File
Change - Hook
Event Name - Hook
Execution Mode - Hook
Handler Type - Hook
Output Entry Kind - Hook
RunStatus - Hook
Scope - Hook
Source - Hook
Trust Status - Initial
History - Internal
Session Source - McpAuth
Status - McpStartup
Failure Reason - McpStartup
Status - Model
Reroute Reason - Model
Verification - Multi
Agent Version - Network
Access - Represents whether outbound network access is available to the agent.
- NonSteerable
Turn Kind - Turn kinds that reject same-turn steering.
- Op
- Submission operation
- Patch
Apply Status - Product
- Rate
Limit Reached Type - Realtime
Conversation Version - Realtime
Event - Realtime
Output Modality - Realtime
Voice - Review
Decision - User’s decision in response to an ExecApprovalRequest.
- Review
Delivery - Review
Target - Rollout
Item - Sandbox
Policy - Determines execution restrictions for model shell commands.
- Session
Source - Skill
Scope - SubAgent
Activity Kind - SubAgent
Source - Thread
Goal Status - Thread
History Mode - Thread
Memory Mode - Thread
Source - Truncation
Policy - Turn
Abort Reason
Constants§
- APPS_
INSTRUCTIONS_ CLOSE_ TAG - APPS_
INSTRUCTIONS_ OPEN_ TAG - COLLABORATION_
MODE_ CLOSE_ TAG - COLLABORATION_
MODE_ OPEN_ TAG - CONTEXT_
WINDOW_ CLOSE_ TAG - CONTEXT_
WINDOW_ GUIDANCE_ CLOSE_ TAG - CONTEXT_
WINDOW_ GUIDANCE_ OPEN_ TAG - CONTEXT_
WINDOW_ OPEN_ TAG - ENVIRONMENTS_
INSTRUCTIONS_ CLOSE_ TAG - ENVIRONMENTS_
INSTRUCTIONS_ OPEN_ TAG - ENVIRONMENT_
CONTEXT_ CLOSE_ TAG - ENVIRONMENT_
CONTEXT_ OPEN_ TAG - MAX_
THREAD_ GOAL_ OBJECTIVE_ CHARS - MULTI_
AGENT_ MODE_ CLOSE_ TAG - MULTI_
AGENT_ MODE_ OPEN_ TAG - PLUGINS_
INSTRUCTIONS_ CLOSE_ TAG - PLUGINS_
INSTRUCTIONS_ OPEN_ TAG - REALTIME_
CONVERSATION_ CLOSE_ TAG - REALTIME_
CONVERSATION_ OPEN_ TAG - SKILLS_
INSTRUCTIONS_ CLOSE_ TAG - SKILLS_
INSTRUCTIONS_ OPEN_ TAG - USER_
INSTRUCTIONS_ CLOSE_ TAG - USER_
INSTRUCTIONS_ OPEN_ TAG - Open/close tags for special context blocks. Used across crates to avoid duplicated hardcoded strings.
- USER_
MESSAGE_ BEGIN
Traits§
- HasLegacy
Event - Converts canonical item lifecycle events back into the legacy raw event stream used by
compatibility consumers that have not migrated to
TurnItem.
Functions§
- strip_
user_ message_ prefix - Removes the model-context prefix from a user message before displaying it.
- user_
message_ preview - Returns the user-facing preview text for a user message.
- validate_
thread_ goal_ objective