Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Openai Openai python Response Code Interpreter Call Completed

From Leeroopedia
Knowledge Sources
Domains API_Types, Responses_API
Last Updated 2026-02-15 00:00 GMT

Overview

Concrete streaming event type emitted when a code interpreter call is completed, provided by the openai-python SDK.

Description

ResponseCodeInterpreterCallCompletedEvent is a Pydantic model representing a streaming event emitted when the code interpreter tool call finishes execution. It contains the item_id identifying the code interpreter tool call item, an output_index indicating the position of the output item in the response, a sequence_number for ordering streaming events, and a fixed type literal of "response.code_interpreter_call.completed". This type is auto-generated from the OpenAI OpenAPI specification by Stainless.

Usage

Import ResponseCodeInterpreterCallCompletedEvent when handling streaming events from a Responses API request that uses the code interpreter tool and you need to detect completion of code execution.

Code Reference

Source Location

Signature

class ResponseCodeInterpreterCallCompletedEvent(BaseModel):
    """Emitted when the code interpreter call is completed."""

    item_id: str
    output_index: int
    sequence_number: int
    type: Literal["response.code_interpreter_call.completed"]

Import

from openai.types.responses import ResponseCodeInterpreterCallCompletedEvent

I/O Contract

Fields

Name Type Required Description
item_id str Yes The unique identifier of the code interpreter tool call item.
output_index int Yes The index of the output item in the response for which the call completed.
sequence_number int Yes The sequence number of this event, used to order streaming events.
type Literal["response.code_interpreter_call.completed"] Yes The type of the event. Always "response.code_interpreter_call.completed".

Usage Examples

from openai.types.responses import ResponseCodeInterpreterCallCompletedEvent

# When processing streaming events
for event in stream:
    if isinstance(event, ResponseCodeInterpreterCallCompletedEvent):
        print(f"Code interpreter call {event.item_id} completed")
        print(f"Output index: {event.output_index}")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment