PhoenixKit.API.ControlFields (phoenix_kit v2.63.0)

Copy Markdown View Source

The fields the executor adds to the input of every write tool: modules never declare them.

  • dry_run (boolean) - run the handler without side effects and return the preview; never creates a code or an approval.
  • confirm_token (string) - the one-time code of a dangerous operation, sent with the same arguments as the preview call.
  • idempotency_key (string, 16 to 128 characters of [A-Za-z0-9_-]) - makes a retry safe. REST clients may send it as the Idempotency-Key header instead.

A read tool has none of them, so a request that sends one gets 422, never a silent ignore.

Summary

Functions

The names of the control fields.

The JSON Schema properties the executor adds to tool's input (%{} for a read tool).

Splits a request body into the control fields and the tool's own input.

Whether tool writes: its annotations do not say read_only: true. The only definition of "write tool" in the flow.

Functions

names()

@spec names() :: [String.t()]

The names of the control fields.

properties(tool)

@spec properties(PhoenixKit.API.Tool.t()) :: map()

The JSON Schema properties the executor adds to tool's input (%{} for a read tool).

split(input)

@spec split(map()) :: {map(), map()}

Splits a request body into the control fields and the tool's own input.

write_tool?(tool)

@spec write_tool?(PhoenixKit.API.Tool.t()) :: boolean()

Whether tool writes: its annotations do not say read_only: true. The only definition of "write tool" in the flow.