PhoenixKit.API.ControlFields (phoenix_kit v2.64.1)

Copy Markdown View Source

The fields the executor adds to the input of a write tool: modules never declare them. idempotency_key is left out for a write tool that cannot replay (see below).

  • 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. A write tool that cannot replay (:replay of PhoenixKit.API.Tool is false) has no idempotency_key; the Idempotency-Key header is ignored on it, as on a read tool.

Summary

Functions

The names of the control fields.

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

Whether tool takes an idempotency_key: a write tool that has not given up replay (:replay of PhoenixKit.API.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).

replay_tool?(tool)

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

Whether tool takes an idempotency_key: a write tool that has not given up replay (:replay of PhoenixKit.API.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.