コンテンツにスキップ

Run Error Handlers

RunErrorData dataclass

Snapshot of run data passed to error handlers.

Source code in src/agents/run_error_handlers.py
@dataclass
class RunErrorData:
    """Snapshot of run data passed to error handlers."""

    input: str | list[TResponseInputItem]
    new_items: list[RunItem]
    history: list[TResponseInputItem]
    output: list[TResponseInputItem]
    raw_responses: list[ModelResponse]
    last_agent: Agent[Any]

RunErrorHandlerResult dataclass

Result returned by an error handler.

Source code in src/agents/run_error_handlers.py
@dataclass
class RunErrorHandlerResult:
    """Result returned by an error handler."""

    final_output: Any
    include_in_history: bool = True

RunErrorHandlers

Bases: TypedDict, Generic[TContext]

Error handlers keyed by error kind.

Source code in src/agents/run_error_handlers.py
class RunErrorHandlers(TypedDict, Generic[TContext], total=False):
    """Error handlers keyed by error kind."""

    max_turns: RunErrorHandler[TContext]