Backplane.AgentRuntime.ToolEffects behaviour (backplane_agent_runtime v1.10.14)

Copy Markdown

Tool effects and cancellation boundary for Backplane agent runtime.

Summary

Functions

Rejects an invocation before dispatching any tool or external effect.

Classifies an observed backend result using its admitted descriptor safety.

Types

adapter()

@type adapter() :: module()

result()

@type result() ::
  {:ok, map()}
  | {:error, Backplane.AgentRuntime.Error.t()}
  | {:rejected, Backplane.AgentRuntime.ToolEffects.Rejection.t()}

Callbacks

cancel(map)

@callback cancel(map()) :: :ok | {:error, Backplane.AgentRuntime.Error.t()}

execute(map)

@callback execute(map()) :: result()

Functions

cancel(adapter, invocation)

@spec cancel(adapter(), map()) :: :ok | {:error, Backplane.AgentRuntime.Error.t()}

execute(adapter, invocation, context)

@spec execute(adapter(), map(), map()) ::
  {:ok, map()} | {:error, Backplane.AgentRuntime.Error.t()}

reject(operation, error)

Rejects an invocation before dispatching any tool or external effect.

Only the registered, trusted backend may make this assertion, after its host approval/catalog checks and before dispatch. It is not a reconciliation receipt for work that was started. Generic errors and error details do not prove non-execution. An unknown outcome cannot be turned into a rejection.

The rejection binds the runtime operation identity and exact arguments; the execution boundary validates it before publishing a structured tool error.

settlement(arg1, arg2)

@spec settlement(term(), map()) :: :settled | :uncertain

Classifies an observed backend result using its admitted descriptor safety.

validate_output(output, opts \\ [])

@spec validate_output(map(), keyword()) ::
  {:ok, map()} | {:error, Backplane.AgentRuntime.Error.t()}