> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent Run Outcome • AI Agent SDK

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

# AgentRunOutcome

> Defined in the [**Run Outcome**](../modules/run_outcome) module.

<Badge color="blue">AI Agent</Badge>

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.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph LR
    input["Input Data"] --> agent["Agent: AgentRunOutcome"]
    agent --> output["Output Result"]
    style agent fill:#8B0000,color:#fff
    style input fill:#8B0000,color:#fff
    style output fill:#8B0000,color:#fff
```

## Properties

<ResponseField name="status" type="RunStatus">
  No description available.
</ResponseField>

<ResponseField name="output" type="Optional[str]">
  No description available.
</ResponseField>

<ResponseField name="error" type="Optional[str]">
  No description available.
</ResponseField>

<ResponseField name="error_category" type="Optional[str]">
  No description available.
</ResponseField>

<ResponseField name="elapsed_s" type="float">
  No description available.
</ResponseField>

<ResponseField name="agent_name" type="Optional[str]">
  No description available.
</ResponseField>

<ResponseField name="run_id" type="Optional[str]">
  No description available.
</ResponseField>

<ResponseField name="context" type="Optional">
  No description available.
</ResponseField>

## Methods

<CardGroup cols={2}>
  <Card title="success()" icon="function" href="../functions/AgentRunOutcome-success">
    Create a successful outcome.
  </Card>

  <Card title="failure()" icon="function" href="../functions/AgentRunOutcome-failure">
    Create a general failure outcome.
  </Card>

  <Card title="timeout()" icon="function" href="../functions/AgentRunOutcome-timeout">
    Create a timeout outcome.
  </Card>

  <Card title="cancelled()" icon="function" href="../functions/AgentRunOutcome-cancelled">
    Create a cancelled outcome.
  </Card>

  <Card title="invalid_output()" icon="function" href="../functions/AgentRunOutcome-invalid_output">
    Create an invalid output outcome.
  </Card>

  <Card title="is_success()" icon="function" href="../functions/AgentRunOutcome-is_success">
    Check if the outcome represents successful completion.
  </Card>

  <Card title="is_failure()" icon="function" href="../functions/AgentRunOutcome-is_failure">
    Check if the outcome represents any kind of failure.
  </Card>

  <Card title="is_retryable()" icon="function" href="../functions/AgentRunOutcome-is_retryable">
    Check if this outcome represents a potentially retryable failure.
  </Card>
</CardGroup>

<Accordion title="Internal & Generic Methods">
  * **to\_dict**: Convert to dictionary for serialization or logging.
</Accordion>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/run_outcome.py#L78">
  `praisonaiagents/run_outcome.py` at line 78
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Agents Concept" icon="robot" href="/docs/docs/concepts/agents" />

  <Card title="Single Agent Guide" icon="book-open" href="/docs/docs/guides/single-agent" />

  <Card title="Multi-Agent Guide" icon="users" href="/docs/docs/guides/multi-agent" />

  <Card title="Agent Configuration" icon="gear" href="/docs/docs/configuration/agent-config" />

  <Card title="Auto Agents" icon="wand-magic-sparkles" href="/docs/docs/features/autoagents" />
</CardGroup>
