adk_callbacks behaviour (erlang_adk v0.2.1)

View Source

adk_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.

Callbacks

on_agent_end/2

-callback on_agent_end(AgentName :: binary(), Output :: term()) -> ok.

on_agent_start/2

-callback on_agent_start(AgentName :: binary(), Input :: term()) -> ok.

on_error/1

-callback on_error(Error :: term()) -> ok.

on_tool_end/2

-callback on_tool_end(ToolName :: binary(), Result :: term()) -> ok.

on_tool_start/2

-callback on_tool_start(ToolName :: binary(), Args :: map()) -> ok.

Functions

execute(Handlers, Hook, Args)

-spec execute(Handlers :: [module()], Hook :: atom(), Args :: [term()]) -> ok.

Execute a callback hook across all registered handlers.