Code Execution Models API Reference

January 13, 2026 ยท View on GitHub

Overview

The Code Execution Models define data structures for code execution results, logs, and errors. These models provide enhanced support for multi-format outputs and detailed execution information.

Code module data models.

ExecutionResult

@dataclass
class ExecutionResult()

Single execution result supporting multiple formats

formats

def formats() -> List[str]

Returns all available formats

ExecutionLogs

@dataclass
class ExecutionLogs()

Execution logs

stdout: List[str]

stdout = field(default_factory=list)

stderr: List[str]

stderr = field(default_factory=list)

ExecutionError

@dataclass
class ExecutionError()

Detailed error information

name: str

name = None

value: str

value = None

traceback: str

traceback = None

EnhancedCodeExecutionResult

@dataclass
class EnhancedCodeExecutionResult(ApiResponse)

Enhanced code execution result

result

@property
def result() -> str

Backward compatible text result

CodeExecutionResult

class CodeExecutionResult(ApiResponse)

Result of code execution operations. Kept for backward compatibility but users should transition to EnhancedCodeExecutionResult.

init

def __init__(self, request_id: str = "",
             success: bool = False,
             result: str = "",
             error_message: str = "")

Initialize a CodeExecutionResult.

Arguments:

  • request_id str, optional - Unique identifier for the API request.
  • success bool, optional - Whether the operation was successful.
  • result str, optional - The execution result.
  • error_message str, optional - Error message if the operation failed.

See Also

Related APIs:


Documentation generated automatically from source code using pydoc-markdown.