Agent Run Outcome • AI Agent SDK

AgentRunOutcome: Structured outcome for agent execution, validation, and handoff operations.

AgentRunOutcome

Defined in the Run Outcome module.

AI Agent

Structured outcome for agent execution, validation, and handoff operations.

Replaces freeform string parsing with typed status values that callers can match exhaustively. Provides structured metadata for debugging and retry policies.

Diagram

Input Data

Agent: AgentRunOutcome

Output Result

Properties

ResponseField RunStatus

No description available.

ResponseField Optional[str]

No description available.

ResponseField Optional[str]

No description available.

ResponseField Optional[str]

No description available.

ResponseField float

No description available.

ResponseField Optional[str]

No description available.

ResponseField Optional[str]

No description available.

ResponseField Optional

No description available.

Methods

Internal & Generic Methods
  • to_dict: Convert to dictionary for serialization or logging.

Usage

python
Success case:
    >>> outcome = AgentRunOutcome(status="success", output="Task completed")
    >>> assert outcome.is_success()

    Validation failure:
    >>> outcome = AgentRunOutcome(
    ...     status="invalid_output", 
    ...     error="Output format is invalid",
    ...     error_category="validation"
    ... )
    >>> assert outcome.is_retryable()

    Timeout with context:
    >>> outcome = AgentRunOutcome(
    ...     status="timeout",
    ...     error="Agent timed out after 30s",
    ...     elapsed_s=30.0,
    ...     agent_name="researcher"
    ... )

Source

View on GitHub

praisonaiagents/run_outcome.py at line 78


Related Documentation