Back to Adk Python

Agent

.agents/skills/adk-architecture/references/interfaces/agent.md

2.0.0b11.5 KB
Original Source

Agent

The Agent (represented by BaseAgent in code) is a public interface in ADK that serves as a blueprint defining identity, instructions, and tools for an agentic entity. It inherits from BaseNode and can be part of a larger workflow or act as a standalone agent.

Key Characteristics

  • Name: Unique identifier within the agent tree. Must be a valid Python identifier and cannot be "user".
  • Description: Capability description used by the model for delegation.
  • Sub-agents: Support for hierarchical agent structures.
  • Callbacks: Supports before_agent_callback and after_agent_callback for intercepting lifecycle events.

Entrance Methods

[!IMPORTANT] Since agents now extend BaseNode, the original run_async entrance method is considered deprecated. Developers should rely on the new run method from BaseNode to execute agents as workflow nodes.

run (Preferred Entrance)

The method inherited from BaseNode to execute the agent.

run_async (Deprecated)

Legacy entry method to run an agent via text-based conversation.

Arguments:

  • parent_context: InvocationContext, the invocation context of the parent agent.

Yields:

  • Event: The events generated by the agent.

run_live

Entry method to run an agent via video/audio-based conversation.

Arguments:

  • parent_context: InvocationContext, the invocation context of the parent agent.

Yields:

  • Event: The events generated by the agent.

from_config

Class method to create an agent from a configuration object.