# next_approval_mode

> **Function** in `deepagents_code`

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

Return the next Shift+Tab approval mode for the active session.

The cycle is Manual → Auto → YOLO → Manual when both Auto and the YOLO
switcher entry are available. Auto is omitted when `auto_eligible` is false
(for example a remote sandbox). YOLO is omitted when orgs/users disable
`startup.yolo_switcher`. Launching with `--yolo` still leaves unrestricted
mode when the switcher entry is disabled; Shift+Tab only exits YOLO then.

## Signature

```python
next_approval_mode(
    current: ApprovalMode | str | object,
    *,
    auto_eligible: bool,
    yolo_switcher_enabled: bool,
) -> ApprovalMode | None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `current` | `ApprovalMode \| str \| object` | Yes | Active approval mode (mode enum or raw value). |
| `auto_eligible` | `bool` | Yes | Whether classifier-backed Auto can be selected. |
| `yolo_switcher_enabled` | `bool` | Yes | Whether unrestricted YOLO appears in the cycle. |

## Returns

`ApprovalMode | None`

The next mode, or `None` when no alternate mode is available.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/4bfa52000ef65ac623d8ada0cb67f67cbdd663ea/libs/code/deepagents_code/approval_mode.py#L77)