Agentix.Executor (Agentix v0.1.0)

Copy Markdown View Source

The executor axis of a tool — who produces a tool call's result.

The set is closed and small:

  • :server — your code runs it and returns a result (the default).
  • :human — the human is the executor; their answer is the result (elicitation).
  • :client — runs in the browser/LiveView over the socket.
  • :provider — the provider executes it; the result returns in the stream.

Keeping the enum closed is deliberate: when set-theoretic type syntax lands (~Elixir 1.22) this becomes a declared, exhaustiveness-checked union.

Summary

Functions

All valid executors.

Returns true if value is a valid executor.

Returns executor unchanged, raising ArgumentError if it is not valid.

Types

t()

@type t() :: :server | :human | :client | :provider

Functions

all()

@spec all() :: [t()]

All valid executors.

iex> Agentix.Executor.all()
[:server, :human, :client, :provider]

valid?(value)

@spec valid?(term()) :: boolean()

Returns true if value is a valid executor.

iex> Agentix.Executor.valid?(:server)
true
iex> Agentix.Executor.valid?(:nope)
false

validate!(executor)

@spec validate!(term()) :: t()

Returns executor unchanged, raising ArgumentError if it is not valid.

iex> Agentix.Executor.validate!(:human)
:human

iex> Agentix.Executor.validate!(:nope)
** (ArgumentError) invalid executor :nope; expected one of [:server, :human, :client, :provider]