Agent Development Kit - A flexible and modular framework for developing and deploying AI agents
npx @tessl/cli install tessl/pypi-google-adk@1.13.0A comprehensive Python framework designed for building, evaluating, and deploying sophisticated AI agents with maximum flexibility and control. This code-first toolkit provides developers with a rich ecosystem of pre-built tools, seamless integration with the Google ecosystem (particularly Gemini models), and the ability to create modular multi-agent systems that can be deployed anywhere from Cloud Run to Vertex AI Agent Engine.
pip install google-adkimport google.adk
from google.adk import Agent, RunnerFor agents and execution:
from google.adk.agents import Agent, LlmAgent, BaseAgent, LoopAgent, ParallelAgent, SequentialAgent
from google.adk.runners import Runner, InMemoryRunnerFor tools:
from google.adk.tools import BaseTool, FunctionTool, google_search, enterprise_web_searchfrom google.adk.agents import Agent
from google.adk.tools import google_search
# Create a simple search assistant
agent = Agent(
name="search_assistant",
model="gemini-2.0-flash",
instruction="You are a helpful assistant. Answer user questions using Google Search when needed.",
description="An assistant that can search the web.",
tools=[google_search]
)
# Run the agent using InMemoryRunner (recommended for simple usage)
from google.adk.runners import InMemoryRunner
from google.genai import types
runner = InMemoryRunner(agent)
user_message = types.Content(parts=[types.Part(text="What's the weather like today?")])
# Execute and get events
for event in runner.run(
user_id="user123",
session_id="session456",
new_message=user_message
):
if event.content:
print(event.content)from google.adk.agents import LlmAgent
# Define individual agents
greeter = LlmAgent(
name="greeter",
model="gemini-2.0-flash",
instruction="Greet users warmly and professionally."
)
task_executor = LlmAgent(
name="task_executor",
model="gemini-2.0-flash",
instruction="Execute tasks efficiently and provide detailed results."
)
# Create coordinator agent with sub-agents
coordinator = LlmAgent(
name="Coordinator",
model="gemini-2.0-flash",
description="I coordinate greetings and tasks.",
sub_agents=[greeter, task_executor]
)
# Run the multi-agent system using InMemoryRunner
from google.adk.runners import InMemoryRunner
from google.genai import types
runner = InMemoryRunner(coordinator)
user_message = types.Content(parts=[types.Part(text="Hello, can you help me with a task?")])
# Execute and get events
for event in runner.run(
user_id="user123",
session_id="session456",
new_message=user_message
):
if event.content:
print(event.content)The ADK follows a modular, hierarchical architecture:
Core agent classes and configuration for building single agents and multi-agent systems, supporting various execution patterns and orchestration strategies.
class Agent: ... # Main agent class (alias for LlmAgent)
class BaseAgent: ... # Abstract base class for all agents
class LlmAgent: ... # LLM-based agent implementation
class LoopAgent: ... # Agent that executes in a loop
class ParallelAgent: ... # Agent for parallel task execution
class SequentialAgent: ... # Agent for sequential task executionRunners provide the execution environment for agents, supporting synchronous, asynchronous, and streaming execution modes with resource management and cleanup.
class Runner:
def __init__(
self,
*,
app_name: str,
agent: BaseAgent,
plugins: Optional[List[BasePlugin]] = None,
artifact_service: Optional[BaseArtifactService] = None,
session_service: BaseSessionService,
memory_service: Optional[BaseMemoryService] = None,
credential_service: Optional[BaseCredentialService] = None,
): ...
def run(
self,
*,
user_id: str,
session_id: str,
new_message: types.Content,
run_config: RunConfig = RunConfig(),
) -> Generator[Event, None, None]: ...
async def run_async(
self,
*,
user_id: str,
session_id: str,
new_message: types.Content,
state_delta: Optional[dict[str, Any]] = None,
run_config: RunConfig = RunConfig(),
) -> AsyncGenerator[Event, None]: ...
async def run_live(
self,
*,
user_id: Optional[str] = None,
session_id: Optional[str] = None,
live_request_queue: LiveRequestQueue,
run_config: RunConfig = RunConfig(),
session: Optional[Session] = None,
) -> AsyncGenerator[Event, None]: ...
async def close(self): ...
class InMemoryRunner(Runner):
def __init__(
self,
agent: BaseAgent,
*,
app_name: str = 'InMemoryRunner',
plugins: Optional[list[BasePlugin]] = None,
): ...Comprehensive tool ecosystem including built-in tools, custom function wrappers, and specialized toolsets for Google Cloud services, databases, and APIs.
class BaseTool: ... # Base class for all tools
class FunctionTool: ... # Tool wrapper for Python functions
class LongRunningFunctionTool: ... # Tool for long-running operations
class AgentTool: ... # Tool for agent interactions
# Built-in tool functions
def google_search(query: str, **kwargs): ...
def enterprise_web_search(query: str, **kwargs): ...
def url_context(url: str): ...
def get_user_choice(choices: list, prompt: str = None): ...Model integration layer supporting Google Gemini and other LLM providers with a unified interface and model registry for management.
class BaseLlm: ... # Base class for LLM implementations
class Gemini: ... # Google Gemini LLM implementation
class LLMRegistry: ... # Registry for LLM model managementSpecialized toolsets for Google Cloud services including BigQuery, Bigtable, Spanner, and Google APIs (Calendar, Gmail, Sheets, Docs, YouTube).
class BigQueryToolset: ... # BigQuery database interaction
class BigtableToolset: ... # Bigtable interaction toolset
class SpannerToolset: ... # Spanner database interaction
class GoogleApiToolset: ... # Generic Google API toolset
class CalendarToolset: ... # Google Calendar integration
class GmailToolset: ... # Gmail integrationInfrastructure services for persistent memory, session state, and artifact storage with support for in-memory and cloud-based implementations.
class BaseMemoryService: ... # Base class for memory services
class InMemoryMemoryService: ... # In-memory memory implementation
class VertexAiMemoryBankService: ... # Vertex AI memory bank service
class BaseSessionService: ... # Base class for session services
class InMemorySessionService: ... # In-memory session implementation
class VertexAiSessionService: ... # Vertex AI session serviceAuthentication framework supporting OAuth2, OpenID Connect, and Google Cloud authentication with configurable schemes and credential management.
class AuthCredential: ... # Authentication credential object
class OAuth2Auth: ... # OAuth2 authentication
class OpenIdConnectWithConfig: ... # OpenID Connect authentication
class AuthHandler: ... # Authentication handler
class AuthConfig: ... # Authentication configurationCode execution framework supporting built-in, local, container-based, and Vertex AI code execution environments with safety controls.
class BaseCodeExecutor: ... # Base class for code executors
class BuiltInCodeExecutor: ... # Built-in code executor
class UnsafeLocalCodeExecutor: ... # Local code executor (unsafe)
class VertexAiCodeExecutor: ... # Vertex AI code executor
class ContainerCodeExecutor: ... # Container-based code executorPlanning, evaluation, event system, and plugin framework for sophisticated agent behaviors and custom extensions.
class BasePlanner: ... # Base class for planners
class BuiltInPlanner: ... # Built-in planner implementation
class AgentEvaluator: ... # Agent evaluation framework
class Event: ... # Event object for agent communication
class BasePlugin: ... # Base class for plugins# Core execution types
class InvocationContext:
"""Context passed during agent invocation."""
pass
class RunConfig:
"""Configuration for agent execution."""
pass
class Event:
"""Event object for agent communication and results."""
pass
# Tool and context types
class ToolContext:
"""Context passed to tools during execution."""
pass
# Live streaming types
class LiveRequest:
"""Live request object for streaming."""
pass
class LiveRequestQueue:
"""Queue for managing live requests."""
pass
# Session and memory types
class Session:
"""Session object for conversation state."""
pass
# Service interfaces
class BaseAgent:
"""Abstract base class for all agents."""
pass
class BasePlugin:
"""Base class for plugins."""
pass
class BaseArtifactService:
"""Base class for artifact services."""
pass
class BaseSessionService:
"""Base class for session services."""
pass
class BaseMemoryService:
"""Base class for memory services."""
pass
class BaseCredentialService:
"""Base class for credential services."""
pass
# External types (from google.genai)
from google.genai import types # Content, Part, etc.
from typing import Generator, AsyncGenerator, Optional, List, Any