# `Codex.Approvals`
[🔗](https://github.com/nshkrdotcom/codex_sdk/blob/v0.16.1/lib/codex/approvals.ex#L1)

Approval helpers invoked by the auto-run pipeline when actions require consent.

Supports both synchronous and asynchronous approval workflows via pluggable hooks.

# `async_result`

```elixir
@type async_result() ::
  {:async, reference()} | {:async, reference(), metadata :: map()}
```

# `decision`

```elixir
@type decision() :: :allow | {:deny, String.t()}
```

# `review_result`

```elixir
@type review_result() :: decision() | async_result()
```

# `review_tool`

```elixir
@spec review_tool(term(), map(), map(), keyword()) :: review_result()
```

Reviews a tool invocation given the configured policy or hook.

## Parameters
- `policy_or_hook` - StaticPolicy struct, hook module, or nil
- `event` - Tool call event (must contain `:tool_name` and `:call_id`)
- `context` - Approval context
- `opts` - Optional keyword list with `:timeout` (default: 30_000ms)

## Returns
- `:allow` - approve the operation
- `{:deny, reason}` - deny with reason
- `{:async, ref}` or `{:async, ref, metadata}` - async approval pending

## Telemetry
Emits the following events:
- `[:codex, :approval, :requested]` - when approval is requested
- `[:codex, :approval, :approved]` - when synchronously approved
- `[:codex, :approval, :denied]` - when denied
- `[:codex, :approval, :timeout]` - when async approval times out

---

*Consult [api-reference.md](api-reference.md) for complete listing*
