The core agent protocol. Every agent type implements this.
Each agent is a struct with at minimum a name field. The protocol
provides polymorphic dispatch for running agents and accessing metadata.
Implementing a custom agent
defmodule MyAgent do
@enforce_keys [:name]
defstruct [:name, description: "", sub_agents: []]
defimpl ADK.Agent do
def name(agent), do: agent.name
def description(agent), do: agent.description
def sub_agents(agent), do: agent.sub_agents
def run(agent, ctx), do: [ADK.Event.new(%{author: agent.name, content: "hello"})]
end
end
Summary
Functions
Human-readable description.
Agent name identifier.
Execute the agent, returning a list of events.
Child agents for delegation.
Types
@type t() :: term()
All the types that implement this protocol.
Functions
Human-readable description.
Agent name identifier.
@spec run(t(), ADK.Context.t()) :: [ADK.Event.t()]
Execute the agent, returning a list of events.
Child agents for delegation.