ADK.Agent behaviour (adk_ex v1.1.0)

Copy Markdown View Source

Behaviour for ADK agents.

All agent types (LLM, Sequential, Parallel, Loop, Custom) implement this behaviour. The run/2 callback returns a stream (Enumerable) of ADK.Event structs.

Summary

Callbacks

Returns the agent's description (used by LLMs for delegation decisions).

Returns the agent's unique name within the agent tree.

Runs the agent and returns a stream of events.

Returns the agent's sub-agents (empty list if none).

Callbacks

description(agent)

@callback description(agent :: struct()) :: String.t()

Returns the agent's description (used by LLMs for delegation decisions).

name(agent)

@callback name(agent :: struct()) :: String.t()

Returns the agent's unique name within the agent tree.

run(agent, ctx)

@callback run(agent :: struct(), ctx :: ADK.Agent.InvocationContext.t()) :: Enumerable.t()

Runs the agent and returns a stream of events.

The returned value must be an Enumerable that yields ADK.Event.t() structs.

sub_agents(agent)

(optional)
@callback sub_agents(agent :: struct()) :: [struct()]

Returns the agent's sub-agents (empty list if none).