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 Tool Call Param

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

Overview

Concrete parameter type for representing a code interpreter tool call in request payloads, provided by the openai-python SDK.

Description

ResponseCodeInterpreterToolCallParam is a TypedDict describing a tool call to run code via the code interpreter. It includes the call id, the code to execute (or null if unavailable), the container_id of the execution environment, outputs (a list of OutputLogs or OutputImage items), a status field indicating execution state, and a fixed type of "code_interpreter_call". The module also exports the helper types OutputLogs (with logs and type fields), OutputImage (with url and type fields), and the Output type alias that is a union of both. This type is auto-generated from the OpenAI OpenAPI specification by Stainless.

Usage

Import ResponseCodeInterpreterToolCallParam when constructing input items that include code interpreter tool call results to pass back to the Responses API.

Code Reference

Source Location

Signature

class ResponseCodeInterpreterToolCallParam(TypedDict, total=False):
    """A tool call to run code."""

    id: Required[str]
    code: Required[Optional[str]]
    container_id: Required[str]
    outputs: Required[Optional[Iterable[Output]]]
    status: Required[Literal["in_progress", "completed", "incomplete", "interpreting", "failed"]]
    type: Required[Literal["code_interpreter_call"]]

Import

from openai.types.responses import ResponseCodeInterpreterToolCallParam

I/O Contract

Fields

Name Type Required Description
id str Yes The unique ID of the code interpreter tool call.
code Optional[str] Yes The code to run, or null if not available.
container_id str Yes The ID of the container used to run the code.
outputs Optional[Iterable[Output]] Yes The outputs generated by the code interpreter (logs or images). Can be null.
status Literal["in_progress", "completed", "incomplete", "interpreting", "failed"] Yes The status of the code interpreter tool call.
type Literal["code_interpreter_call"] Yes The type of the tool call. Always "code_interpreter_call".

Output Sub-Types

Type Fields Description
OutputLogs logs: str, type: Literal["logs"] Log output from the code interpreter.
OutputImage url: str, type: Literal["image"] Image output with a URL from the code interpreter.

Usage Examples

from openai.types.responses import ResponseCodeInterpreterToolCallParam

tool_call: ResponseCodeInterpreterToolCallParam = {
    "id": "ci_abc123",
    "code": "print('hello world')",
    "container_id": "container_xyz",
    "outputs": [{"type": "logs", "logs": "hello world"}],
    "status": "completed",
    "type": "code_interpreter_call",
}

Related Pages

Page Connections

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