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

# Classify Finish Reason • AI Agent SDK

> classify_finish_reason: Map a provider ``finish_reason``/refusal signal to a terminal reason.

# classify\_finish\_reason

Function

> This function is defined in the [**run\_outcome**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/run_outcome.md) module.

Map a provider `finish_reason`/refusal signal to a terminal reason.

Returns one of `content_filtered | refused | length_truncated` when the
provider blocked/refused/truncated the turn, or `None` for a normal stop
(`None`/`"stop"`) or any unrecognised value — so unknown finish reasons
behave exactly as today. Additive and zero-cost on the success path.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def classify_finish_reason(finish_reason: Any, refusal: Any) -> Any
```

## Parameters

**finish\_reason** `Any` *required*

No description available.

**refusal** `Any`

No description available.

### Returns

**Returns** `Any`

The result of the operation.

## Source

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


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