# output_truncation

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/output_truncation/output_truncation)

Classify whether the provider stopped this message early.

Reads the raw provider metadata on `response_metadata`, so it also works on
the streamed chunk that carries the stop reason.

## Signature

```python
output_truncation(
    message: BaseMessage,
) -> OutputTruncation | None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `message` | `BaseMessage` | Yes | A model message or streamed message chunk. |

## Returns

`OutputTruncation | None`

The truncation, or `None` when the reply ended normally or the
metadata does not say.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/efa9f5364b83e9367ea57d9c21b15b4d81fdcb7a/libs/code/deepagents_code/output_truncation.py#L109)