Skip to content

Errors

EngineError

Bases: RuntimeError

Base SDK error, including engine startup, connection and protocol failures.

Source code in src/openai_agents/codex/errors.py
class EngineError(RuntimeError):
    """Base SDK error, including engine startup, connection and protocol failures."""

RunError

Bases: EngineError

A failed run with the items and usage observed before the failure.

Source code in src/openai_agents/codex/errors.py
class RunError(EngineError):
    """A failed run with the items and usage observed before the failure."""

    def __init__(self, message: str, *, code: str, details: dict[str, Any] | None = None) -> None:
        super().__init__(message)
        self.code = code
        self.details = details or {}
        self.turn_id: str | None = None
        self.new_items: list[RunItem] = []
        self.usage = Usage(responses=[])

ToolError

Bases: RunError

A Python handler failed. The original exception is available as cause.

Source code in src/openai_agents/codex/errors.py
class ToolError(RunError):
    """A Python handler failed. The original exception is available as __cause__."""

    def __init__(self, message: str, *, tool_name: str, call_id: str) -> None:
        super().__init__(message, code="tool_error")
        self.tool_name = tool_name
        self.call_id = call_id