.agents/references/run-item-lifecycle.md
Use this reference for changes to model output processing, RunItem types, tool call and output items, stream events, replay conversion, session history, or serialized run state.
The runtime carries one semantic item through several representations:
ModelResponse.output.process_model_response() converts recognized output into public RunItem objects and internal executable tool-run records in ProcessedResponse.SingleStepResult.next_step.RunResult, semantic stream events, session persistence, tracing, and RunState serialization.RunItem.to_input_item() or run_item_to_input_item() after SDK-only metadata is handled.Keep provider payloads, public run items, and internal execution records distinct. A provider item may be observable without requiring local execution, while a local tool-run record may need to preserve the selected SDK tool object and routing identity.
new_step_items describes items generated by the current step.session_step_items preserves the full unfiltered sequence when session history must retain items that a handoff or input filter omitted from the next model request.generated_items is the public observability view and prefers session_step_items when present.Do not force these views into one list. History persistence, user-visible results, and the next provider request have different correctness requirements.
Update every applicable surface together:
src/agents/items.py for the public RunItem type, accessors, and replay conversion.src/agents/run_internal/run_steps.py for processed response and executable tool-run records.src/agents/run_internal/turn_resolution.py for provider output recognition, item creation, side effects, and next-step selection.src/agents/run_internal/tool_execution.py, tool_actions.py, or tool_planning.py for execution, dedupe, approvals, and outputs.src/agents/run_internal/items.py for normalization, replay conversion, fingerprints, dedupe, and provider-boundary metadata stripping.src/agents/stream_events.py and streaming queue helpers for public semantic events.src/agents/run_state.py for serialization and deserialization when the item can survive interruption.src/agents/run_internal/session_persistence.py for session conversion, sanitization, and retry accounting.reasoning_item_id_policy="omit" strips IDs only from SDK-generated follow-up reasoning items. It does not rewrite initial caller input, must survive RunState resume, and can be superseded by a later call_model_input_filter that deliberately returns IDs.provider_data and provider IDs have boundary-specific ownership. Preserve them for raw results and provider requests that accept them, but strip private or replay-unsafe metadata from session and server-conversation history where the SDK contract requires sanitized items.RunState.src/agents/items.pysrc/agents/stream_events.pysrc/agents/run_internal/items.pysrc/agents/run_internal/run_steps.pysrc/agents/run_internal/turn_resolution.pysrc/agents/run_internal/session_persistence.pysrc/agents/run_state.pytests/test_items_helpers.pytests/test_run_internal_items.pytests/test_stream_events.pytests/test_run_state.pydocs/running_agents.mddocs/results.md