> ## 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.

# From Exception • AI Agent SDK

> from_exception: Normalise a raised exception into a canonical terminal outcome.

# from\_exception

Method

> This is a method of the [**RunOutcome**](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/RunOutcome.md) class in the [**run\_outcome**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/run_outcome.md) module.

Normalise a raised exception into a canonical terminal outcome.

Maps well-known exception types to their terminal reason. Anything
unrecognised is treated as `failed` with a redacted message.

Note on `hard_timeout`: the run-level budget is the authoritative
source of `hard_timeout` and is applied explicitly by the caller
(see `_astart_with_outcome`). A bare `asyncio.TimeoutError` reaching
this normaliser is a *nested* operation timeout (e.g. a handoff/tool that
exhausted its own budget while the run budget remained) and is therefore
classified as `failed` — not silently promoted to a run-budget
`hard_timeout`, which would drive the wrong host retry/DLQ decision.
Real cooperative cancellation is intercepted and re-raised by the run
wrapper (see `_astart_with_outcome`) *before* it reaches this
normaliser, so host shutdown is honoured. A supersede/interrupt named
error that does surface here is a domain "cancelled" outcome.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def from_exception(exc: BaseException, output: Optional[str]) -> 'RunOutcome'
```

## Parameters

**exc** `BaseException` *required*

No description available.

**output** `Optional[str]`

No description available.

### Returns

**Returns** `'RunOutcome'`

The result of the operation.

## Uses

* `cls`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/agent/run_outcome.py#L78)
>
> `praisonaiagents/agent/run_outcome.py` at line 78


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.