Codex.ToolGuardrail (Codex SDK v0.7.2)

Copy Markdown View Source

Guardrail applied before or after tool invocation.

Summary

Functions

Builds a tool guardrail definition.

Runs the guardrail handler for a tool call.

Types

stage()

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

t()

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

Functions

new(opts)

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

Builds a tool guardrail definition.

run(arg1, event, payload, context)

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

Runs the guardrail handler for a tool call.