Skip to main content
ThreadItem is the core data structure representing user inputs and agent outputs within a turn. Items are persisted and used as context for future conversations.

Item Lifecycle

All items follow a consistent lifecycle:
1

item/started

Emits the full item when a new unit of work begins
2

Item-specific deltas (optional)

Zero or more streaming updates
  • item/agentMessage/delta - Agent text streaming
  • item/commandExecution/outputDelta - Command output streaming
  • item/reasoning/summaryTextDelta - Reasoning summary streaming
3

item/completed

Sends the final item once work finishes

Item Types

userMessage

User text or image input.
string
required
Item identifier
UserInput[]
required
Array of user input items (text, image, localImage, skill, mention)
Example:

agentMessage

Agent response text.
string
required
Item identifier
string
required
Accumulated agent reply text
MessagePhase
Message phase (when applicable)
Streaming:
Concatenate delta values for the same itemId to reconstruct the full reply.

plan

EXPERIMENTAL - Proposed plan item content.
string
required
Item identifier
string
required
Plan text
Streaming:
The completed plan item is authoritative and may not match the concatenation of PlanDelta text.

reasoning

Agent reasoning traces.
string
required
Item identifier
string[]
required
Streamed reasoning summaries (applicable for most OpenAI models)
string[]
required
Raw reasoning blocks (applicable for open source models)
Streaming notifications:

commandExecution

Sandboxed shell command.
string
required
Item identifier
string
required
The command to execute
string
required
Command working directory
string
PTY process identifier (when available)
CommandExecutionStatus
required
inProgress, completed, failed, or declined
CommandAction[]
required
Best-effort parsing of command actions
string
Combined stdout/stderr output
number
Command exit code
number
Execution duration in milliseconds
Streaming:

fileChange

Proposed or applied file edits.
string
required
Item identifier
FileUpdateChange[]
required
Array of file changes with path, kind, and diff
PatchApplyStatus
required
inProgress, completed, failed, or declined
Streaming:

mcpToolCall

MCP (Model Context Protocol) tool invocation.
string
required
Item identifier
string
required
MCP server name
string
required
Tool name
string
required
inProgress, completed, or failed
object
required
Tool arguments (JSON)
object
Tool result (when completed)
object
Error details (when failed)
number
Call duration in milliseconds
Example:

dynamicToolCall

Dynamic tool call executed on the client.
string
required
Item identifier
string
required
Tool name
object
required
Tool arguments (JSON)
string
required
inProgress, completed, or failed
object[]
Output content items (text/images)
boolean
Whether the tool call succeeded
number
Call duration in milliseconds

webSearch

Web search request issued by the agent.
string
required
Item identifier
string
required
Search query
WebSearchAction
Action payload (search, open_page, find_in_page)
Example:

imageView

Image viewer tool invocation.
string
required
Item identifier
string
required
Path to the image file
Example:

enteredReviewMode

Emitted when the reviewer starts.
string
required
Item identifier
string
required
Short user-facing label (e.g., "current changes", "commit abc123")

exitedReviewMode

Emitted when the reviewer finishes.
string
required
Item identifier
string
required
Full plain-text review (overall notes plus bullet point findings)
Example:

contextCompaction

Emitted when Codex compacts conversation history.
string
required
Item identifier
Example:
Context compaction can happen automatically when the conversation history grows too large.

Item Notifications Summary

notification
Emits the full item when work begins
notification
Sends the final item once work finishes
notification
Streams agent message text
notification
Streams plan content (experimental)
notification
Streams reasoning summary text
notification
Marks reasoning summary section boundaries
notification
Streams raw reasoning text (open source models)
notification
Streams command stdout/stderr
notification
Streams file change tool output
notification
MCP tool call progress updates

Approvals

Certain actions (shell commands or file changes) may require explicit user approval depending on the approval policy.

Command Execution Approval

Order of messages:
1

item/started

Shows pending commandExecution item
2

item/commandExecution/requestApproval (server request)

3

Client response

Possible decisions:
  • accept - Approve the command
  • acceptForSession - Approve and cache for session
  • acceptWithExecpolicyAmendment - Approve with persistent rule
  • applyNetworkPolicyAmendment - Apply network policy rule
  • decline - Deny the command
  • cancel - Deny and interrupt turn
4

serverRequest/resolved

Confirms the request was resolved
5

item/completed

Final item with execution result

File Change Approval

Order of messages:
1

item/started

Emits fileChange item with diff summaries
2

item/fileChange/requestApproval (server request)

3

Client response

Possible decisions:
  • accept - Approve the changes
  • decline - Deny the changes
4

serverRequest/resolved

Confirms the request was resolved
5

item/completed

Final item with status: "completed", "failed", or "declined"

Next Steps

Models

List available models and capabilities

Skills

Manage and invoke skills