George Weale fabf0fd552 test: stop the cross-loop startup tests from racing on their own mock
Both cross-loop startup tests entered mock.patch.object on the shared
plugin instance from inside each worker thread. patch.object swaps and
restores one attribute on one object and is not thread safe: when two
threads read the original before either installs its mock, both record
that the attribute was absent from the instance, and both delete it on
exit. The second delete raises, so the test failed with

  AttributeError: object has no attribute "_lazy_setup"

which is the mock unwinding itself, not anything about coalescing.

Install the mock once from the test thread and let the worker threads
race only on _ensure_started, which is what these tests are for. The
behaviour under test is unchanged: both loops still call in concurrently
and setup still has to coalesce to a single run.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 953746627
2026-07-24 23:42:32 -07:00
2025-11-03 13:33:53 -08:00

Agent Development Kit (ADK) 2.0

License PyPI version Python versions PyPI downloads Unit Tests Docs

An open-source, code-first Python framework for building, evaluating, and deploying sophisticated AI agents with flexibility and control.


⚠️ BREAKING CHANGES FROM 1.x

This release includes breaking changes to the agent API, event model, and session schema. Sessions generated by ADK 2.0 are readable by ADK 1.28+ (extra fields will be ignored), but are incompatible with older 1.x versions.


🔥 What's New in 2.0

  • Workflow Runtime: A graph-based execution engine for composing deterministic execution flows for agentic apps, with support for routing, fan-out/fan-in, loops, retry, state management, dynamic nodes, human-in-the-loop, and nested workflows.

  • Task API: Structured agent-to-agent delegation with multi-turn task mode, single-turn controlled output, mixed delegation patterns, human-in-the-loop, and task agents as workflow nodes.

🚀 Installation

pip install google-adk

Requirements: Python 3.10+.

To install optional integrations, you can use the following command:

pip install "google-adk[extensions]"

The release cadence is roughly bi-weekly.

Quick Start

Beginner Note: ADK applications are built using two main classes: Agent (defines an AI's instructions, tools, and behavior) and Workflow (orchestrates agents and tasks in a graph-based flow).

Agent

from google.adk import Agent

root_agent = Agent(
    name="greeting_agent",
    model="gemini-2.5-flash",
    instruction="You are a helpful assistant. Greet the user warmly.",
)

Workflow

from google.adk import Agent, Workflow

generate_fruit_agent = Agent(
    name="generate_fruit_agent",
    instruction="Return the name of a random fruit. Return only the name.",
)

generate_benefit_agent = Agent(
    name="generate_benefit_agent",
    instruction="Tell me a health benefit about the specified fruit.",
)

root_agent = Workflow(
    name="root_agent",
    edges=[("START", generate_fruit_agent, generate_benefit_agent)],
)

Run Locally

# Interactive CLI
adk run path/to/my_agent

# Web UI (supports multi-agent directories or pointing directly to a single agent folder)
adk web path/to/agents_dir

📚 Documentation

🤝 Contributing

See CONTRIBUTING.md for details.

📄 License

This project is licensed under the Apache 2.0 License — see the LICENSE file for details.

S
Description
An open-source, code-first Python toolkit for building, evaluating, and deploying sophisticated AI agents with flexibility and control.|GitHub 镜像 21.3k · 🍴 3.9k
https://github.com/google/adk-python Readme Apache-2.0 79 MiB
Languages
Python 77.5%
JavaScript 20.7%
Jupyter Notebook 1.3%
HTML 0.3%