# sanitize_auto_reason

> **Function** in `deepagents_code`

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

Return a compact reason safe for persistence, logs, and UI rendering.

## Signature

```python
sanitize_auto_reason(
    reason: object,
    *,
    known_secrets: Sequence[str] = (),
) -> str
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `reason` | `object` | Yes | Untrusted classifier or provider text. |
| `known_secrets` | `Sequence[str]` | No | Credential values to replace before display. (default: `()`) |

## Returns

`str`

Single-line redacted text capped at 512 characters.

---

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