adk_callbacks behaviour (erlang_adk v0.7.0)
View Sourceadk_callbacks - Behavior and registry for ADK execution callbacks.
Callbacks allow hooking into the execution lifecycle (e.g., on_llm_start, on_tool_call, on_error) for logging, monitoring, or side-effects.
Summary
Functions
Execute a callback hook across all registered handlers.
Run handlers until one explicitly replaces or halts the operation. Observation-only callbacks return ok or continue. A callback may return {replace, Value} to replace an after-hook result, or {halt, Value} to skip the operation wrapped by a before-hook.
Types
Callbacks
-callback after_agent(AgentName :: term(), Output :: term()) -> callback_result().
-callback after_model(Config :: map(), Result :: term()) -> callback_result().
-callback after_tool(ToolName :: binary(), Args :: map(), Context :: map(), Result :: term()) -> callback_result().
-callback before_agent(AgentName :: term(), Input :: term()) -> callback_result().
-callback before_model(Config :: map(), Memory :: list(), Tools :: list()) -> callback_result().
-callback before_tool(ToolName :: binary(), Args :: map(), Context :: map()) -> callback_result().
-callback on_error(Error :: term()) -> ok.
Functions
Execute a callback hook across all registered handlers.
Run handlers until one explicitly replaces or halts the operation. Observation-only callbacks return ok or continue. A callback may return {replace, Value} to replace an after-hook result, or {halt, Value} to skip the operation wrapped by a before-hook.