ADK.Plugin.Manager (adk_ex v1.1.0)

Copy Markdown View Source

Chains plugin callbacks. First non-nil return wins (short-circuit).

All run_* functions accept nil as the first argument, acting as a no-op when no plugin manager is configured. This avoids nil checks at every call site.

Summary

Functions

Creates a new plugin manager from a list of plugins.

Runs after_agent plugins. May replace output with Content.

Runs after_model plugins. May replace LlmResponse.

Runs after_run plugins. Notification only, no short-circuit.

Runs after_tool plugins. May replace result map.

Runs before_agent plugins. May short-circuit with Content.

Runs before_model plugins. May short-circuit with LlmResponse.

Runs before_run plugins. May short-circuit with Content.

Runs before_tool plugins. May short-circuit with result map.

Runs on_event plugins. May modify event.

Runs on_model_error plugins. May recover with LlmResponse.

Runs on_tool_error plugins. May recover with result map.

Runs on_user_message plugins. May modify user content.

Types

t()

@type t() :: %ADK.Plugin.Manager{plugins: [ADK.Plugin.t()]}

Functions

new(plugins)

@spec new([ADK.Plugin.t()]) :: {:ok, t()} | {:error, String.t()}

Creates a new plugin manager from a list of plugins.

Validates that plugin names are unique.

run_after_agent(mgr, cb_ctx)

Runs after_agent plugins. May replace output with Content.

run_after_model(mgr, cb_ctx, response)

Runs after_model plugins. May replace LlmResponse.

run_after_run(mgr, ctx)

Runs after_run plugins. Notification only, no short-circuit.

run_after_tool(mgr, tool_ctx, tool, args, result)

Runs after_tool plugins. May replace result map.

run_before_agent(mgr, cb_ctx)

Runs before_agent plugins. May short-circuit with Content.

run_before_model(mgr, cb_ctx, request)

Runs before_model plugins. May short-circuit with LlmResponse.

run_before_run(mgr, ctx)

Runs before_run plugins. May short-circuit with Content.

run_before_tool(mgr, tool_ctx, tool, args)

Runs before_tool plugins. May short-circuit with result map.

run_on_event(mgr, ctx, event)

Runs on_event plugins. May modify event.

run_on_model_error(mgr, cb_ctx, request, error)

Runs on_model_error plugins. May recover with LlmResponse.

run_on_tool_error(mgr, tool_ctx, tool, error)

Runs on_tool_error plugins. May recover with result map.

run_on_user_message(mgr, ctx, content)

Runs on_user_message plugins. May modify user content.