# `Codex.ToolGuardrail`
[🔗](https://github.com/nshkrdotcom/codex_sdk/blob/v0.18.1/lib/codex/tool_guardrail.ex#L1)

Guardrail applied before or after tool invocation.

# `stage`

```elixir
@type stage() :: :input | :output
```

# `t`

```elixir
@type t() :: %Codex.ToolGuardrail{
  behavior: :allow | :reject_content | :raise_exception,
  handler: function(),
  name: String.t(),
  run_in_parallel: boolean(),
  stage: stage()
}
```

# `new`

```elixir
@spec new(keyword()) :: t()
```

Builds a tool guardrail definition.

# `run`

```elixir
@spec run(t(), map(), term(), map()) ::
  :ok | {:reject, String.t()} | {:tripwire, String.t()}
```

Runs the guardrail handler for a tool call.

---

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