Skip to content

Commit 12e5033

Browse files
authored
Merge branch 'main' into feat/agent-lifecycle-events
2 parents f81d36d + e6df097 commit 12e5033

207 files changed

Lines changed: 14088 additions & 4292 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/adk-agent-builder/SKILL.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,37 @@ description: Central hub for building, testing, and iterating on ADK agents. Tri
55

66
# ADK Agent Builder
77

8-
This file serves as a directory of specialized reference guides for developing agents with ADK. To avoid context pollution, read only the relevant reference file based on your current task.
8+
This file serves as a directory of specialized reference guides for developing
9+
agents with ADK. To avoid context pollution, read only the relevant reference
10+
file based on your current task.
911

1012
## Core Concepts Directory
1113

1214
Refer to these files for foundational knowledge:
15+
1316
- **Getting Started & Basic Agents**: [getting-started.md](references/getting-started.md)
1417
- Environment setup, API key configuration, and minimal agent definitions.
1518
- **Tool Catalog**: [tool-catalog.md](references/tool-catalog.md)
1619
- How to bind function tools, MCP tools, OpenAPI specs, and Google API tools.
1720
- **Agent Modes (Task / Single-Turn)**: [task-mode.md](references/task-mode.md)
1821
- Multi-turn structured delegation and autonomous single-turn execution patterns.
22+
- **Import Paths**: [import-paths.md](references/import-paths.md)
23+
- Canonical and verbose import paths for core components, tools, and
24+
events.
1925

2026
## Workflow & Graph Orchestration
2127

2228
Refer to these files when building complex graphs:
29+
2330
- **Function Nodes**: [function-nodes.md](references/function-nodes.md)
2431
- How to use functions as nodes, type resolution, and generators.
2532
- **Routing & Conditions**: [routing-and-conditions.md](references/routing-and-conditions.md)
2633
- Edge patterns, dict-based routing, self-loops, and conditional execution.
2734
- **LLM Agent Nodes**: [llm-agent-nodes.md](references/llm-agent-nodes.md)
2835
- How to use LLM agents as workflow nodes, task wrappers, and handling output schemas.
36+
- **Advanced Patterns**:
37+
[advanced-patterns.md](references/advanced-patterns.md)
38+
- Nested workflows, custom node types, and graph validation rules.
2939

3040
## Advanced Orchestration Patterns
3141

@@ -40,6 +50,14 @@ Refer to these files when building complex graphs:
4050

4151
- **State & Events**: [state-and-events.md](references/state-and-events.md)
4252
- Using context API, sharing global state, and yield event structures.
53+
- **Session & Memory**:
54+
[session-and-state.md](references/session-and-state.md)
55+
- Session state mutation, scope conventions, and database session
56+
services.
57+
- **Callbacks & Plugins**:
58+
[callbacks-and-plugins.md](references/callbacks-and-plugins.md)
59+
- Implementing callbacks, plugin manager integration, and override
60+
behavior.
4361
- **Multi-Agent Systems**: [multi-agent.md](references/multi-agent.md)
4462
- Hierarchical execution (e.g., `SequentialAgent`, `LoopAgent`, `ParallelAgent`).
4563
- **Testing Strategies**: [testing.md](references/testing.md)

.agents/skills/adk-sample-creator/SKILL.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Each sample should have a `README.md` with the following structure:
8989

9090
- **Overview**: What the sample does.
9191
- **Sample Inputs**: Examples of inputs to test with. Each prompt must be wrapped in backticks. If a prompt has an explanation, always add a blank line between the prompt and the explanation, and indent the explanation by two spaces.
92-
- **Graph**: Visualization of the graph flow (Mermaid recommended for workflows).
92+
- **Graph**: Visualization of the graph flow (Mermaid recommended). For Workflow root agents, visualize the graph flow of nodes. For LlmAgent root agents that orchestrate tools or sub-agents, visualize the topology of the agent and its tools/sub-agents instead of internal workflow nodes.
9393
- **How To**: Explanation of key techniques used (e.g., `ctx.run_node`).
9494
- **Related Guides**: Links to relevant developer guides in `docs/guides/` that explain the concepts or classes used.
9595

@@ -112,11 +112,18 @@ Brief description.
112112

113113
## Graph
114114

115+
For Workflow root agents:
115116
```mermaid
116117
graph TD
117118
START --> MyNode
118119
```
119120

121+
For LlmAgent root agents:
122+
```mermaid
123+
graph TD
124+
MyAgent[my_agent] -->|calls| MyTool(my_tool)
125+
```
126+
120127
## How To
121128

122129
Explain the details.

.github/workflows/analyze-releases-for-adk-docs-updates.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ on:
3737

3838
jobs:
3939
analyze-new-release-for-adk-docs-updates:
40+
if: github.repository == 'google/adk-python'
4041
runs-on: ubuntu-latest
4142
permissions:
4243
contents: read

.github/workflows/block-merge.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ name: Do Not Merge on GitHub
1616

1717
on:
1818
pull_request:
19+
branches: [main]
1920
types: [opened, reopened, synchronize]
2021

2122
jobs:
2223
block-merge:
24+
if: github.repository == 'google/adk-python'
2325
name: maintainers will submit via Copybara
2426
runs-on: ubuntu-latest
2527
steps:

.github/workflows/continuous-integration.yml

Lines changed: 35 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ jobs:
6767

6868
- name: Install uv
6969
uses: astral-sh/setup-uv@v7
70+
with:
71+
enable-cache: true
7072

7173
- name: Generate Baseline
7274
env:
@@ -114,7 +116,7 @@ jobs:
114116
echo "Great job! No new mypy errors introduced."
115117
fi
116118
117-
# 3. Unit testing (Unit Tests with Matrix)
119+
# 3a. Unit testing (Unit Tests with Matrix)
118120
unit-test:
119121
name: Unit Tests (Python ${{ matrix.python-version }})
120122
runs-on: ubuntu-latest
@@ -134,6 +136,8 @@ jobs:
134136

135137
- name: Install the latest version of uv
136138
uses: astral-sh/setup-uv@v7
139+
with:
140+
enable-cache: true
137141

138142
- name: Install dependencies
139143
run: |
@@ -149,128 +153,42 @@ jobs:
149153
--ignore=tests/unittests/artifacts/test_artifact_service.py \
150154
--ignore=tests/unittests/tools/google_api_tool/test_googleapi_to_openapi_converter.py
151155
152-
# 4. Custom file content compliance checks (PR only)
153-
compliance-check:
154-
name: File Content Compliance
156+
# 3b. Dual-version A2A coverage: This job pins a2a-sdk to 0.3.x and
157+
# runs only the A2A-related tests, so the a2a/_compat.py shim stays
158+
# verified against both SDK majors.
159+
# TODO: Remove this 0.3.x re-run once a2a-sdk 0.3.x support is dropped.
160+
unit-test-a2a-v0-3:
161+
name: A2A v0.3 Tests (Python ${{ matrix.python-version }})
155162
runs-on: ubuntu-latest
156-
if: github.event_name == 'pull_request'
163+
strategy:
164+
fail-fast: false
165+
matrix:
166+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
167+
timeout-minutes: 10
157168
steps:
158-
- name: Checkout Code
169+
- name: Checkout code
159170
uses: actions/checkout@v6
160-
with:
161-
# Fetch full history (depth: 0) instead of shallow clone (depth: 2) to ensure
162-
# git diff origin/${base_ref}...HEAD can reliably find the merge base,
163-
# preventing fatal git errors on deep PRs or when the target branch has progressed.
164-
fetch-depth: 0
165171

166-
- name: Check for logger pattern in all changed Python files
167-
run: |
168-
git fetch origin ${GITHUB_BASE_REF}
169-
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${GITHUB_BASE_REF}...HEAD | grep -E '\.py$' || true)
170-
if [ -n "$CHANGED_FILES" ]; then
171-
echo "Changed Python files to check:"
172-
echo "$CHANGED_FILES"
173-
echo ""
174-
175-
# Check for 'logger = logging.getLogger(__name__)' in changed .py files.
176-
set +e
177-
FILES_WITH_FORBIDDEN_LOGGER=$(grep -lE 'logger = logging\.getLogger\(__name__\)' $CHANGED_FILES)
178-
GREP_EXIT_CODE=$?
179-
set -e
180-
181-
if [ $GREP_EXIT_CODE -eq 0 ]; then
182-
echo "❌ Found forbidden use of 'logger = logging.getLogger(__name__)'. Please use 'logger = logging.getLogger('google_adk.' + __name__)' instead."
183-
echo "The following files contain the forbidden pattern:"
184-
echo "$FILES_WITH_FORBIDDEN_LOGGER"
185-
exit 1
186-
elif [ $GREP_EXIT_CODE -eq 1 ]; then
187-
echo "✅ No instances of 'logger = logging.getLogger(__name__)' found in changed Python files."
188-
fi
189-
else
190-
echo "✅ No relevant Python files found."
191-
fi
192-
193-
- name: Check for import pattern in certain changed Python files
194-
run: |
195-
git fetch origin ${GITHUB_BASE_REF}
196-
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${GITHUB_BASE_REF}...HEAD | grep -E '\.py$' | grep -v -E '__init__.py$|version.py$|tests/.*|contributing/samples/' || true)
197-
if [ -n "$CHANGED_FILES" ]; then
198-
echo "Changed Python files to check:"
199-
echo "$CHANGED_FILES"
200-
echo ""
201-
202-
# Use grep -L to find files that DO NOT contain the pattern.
203-
FILES_MISSING_IMPORT=$(grep -L 'from __future__ import annotations' $CHANGED_FILES || true)
172+
- name: Set up Python ${{ matrix.python-version }}
173+
uses: actions/setup-python@v6
174+
with:
175+
python-version: ${{ matrix.python-version }}
204176

205-
if [ -z "$FILES_MISSING_IMPORT" ]; then
206-
echo "✅ All modified Python files include 'from __future__ import annotations'."
207-
exit 0
208-
else
209-
echo "❌ The following files are missing 'from __future__ import annotations':"
210-
echo "$FILES_MISSING_IMPORT"
211-
echo "This import is required to allow forward references in type annotations without quotes."
212-
exit 1
213-
fi
214-
else
215-
echo "✅ No relevant Python files found."
216-
fi
177+
- name: Install the latest version of uv
178+
uses: astral-sh/setup-uv@v7
179+
with:
180+
enable-cache: true
217181

218-
- name: Check for import from cli package in certain changed Python files
182+
- name: Install dependencies
219183
run: |
220-
git fetch origin ${GITHUB_BASE_REF}
221-
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${GITHUB_BASE_REF}...HEAD | grep -E '\.py$' | grep -v -E 'cli/.*|src/google/adk/tools/apihub_tool/apihub_toolset.py|tests/.*|contributing/samples/' || true)
222-
if [ -n "$CHANGED_FILES" ]; then
223-
echo "Changed Python files to check:"
224-
echo "$CHANGED_FILES"
225-
echo ""
226-
227-
set +e
228-
FILES_WITH_FORBIDDEN_IMPORT=$(grep -lE '^from.*\bcli\b.*import.*$' $CHANGED_FILES)
229-
GREP_EXIT_CODE=$?
230-
set -e
231-
232-
if [[ $GREP_EXIT_CODE -eq 0 ]]; then
233-
echo "❌ Do not import from the cli package outside of the cli package. If you need to reuse the code elsewhere, please move the code outside of the cli package."
234-
echo "The following files contain the forbidden pattern:"
235-
echo "$FILES_WITH_FORBIDDEN_IMPORT"
236-
exit 1
237-
else
238-
echo "✅ No instances of importing from the cli package found in relevant changed Python files."
239-
fi
240-
else
241-
echo "✅ No relevant Python files found."
242-
fi
184+
uv venv .venv
185+
source .venv/bin/activate
186+
uv sync --extra test
243187
244-
- name: Check for hardcoded googleapis.com endpoints
188+
- name: Run A2A tests against a2a-sdk v0.3
245189
run: |
246-
git fetch origin ${GITHUB_BASE_REF}
247-
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${GITHUB_BASE_REF}...HEAD | grep -E '\.py$' || true)
248-
if [ -n "$CHANGED_FILES" ]; then
249-
echo "Checking for hardcoded endpoints in: $CHANGED_FILES"
250-
251-
# 1. Identify files containing any googleapis.com URL.
252-
set +e
253-
FILES_WITH_ENDPOINTS=$(grep -lE 'https?://[a-zA-Z0-9.-]+\.googleapis\.com' $CHANGED_FILES)
254-
255-
# 2. From those, identify files that are MISSING the required mTLS version.
256-
if [ -n "$FILES_WITH_ENDPOINTS" ]; then
257-
FILES_MISSING_MTLS=$(grep -L '.mtls.googleapis.com' $FILES_WITH_ENDPOINTS)
258-
fi
259-
set -e
260-
261-
if [ -n "$FILES_MISSING_MTLS" ]; then
262-
echo "❌ Found hardcoded googleapis.com endpoints without mTLS support."
263-
echo "The following files must define both standard and mTLS (.mtls.googleapis.com) endpoints"
264-
echo "to support dynamic endpoint selection as required by security policy:"
265-
echo "$FILES_MISSING_MTLS"
266-
echo ""
267-
echo "To fix this, please follow these steps:"
268-
echo "1. Initialize an AuthorizedSession with your credentials."
269-
echo "2. Use 'mtls.has_default_client_cert_source() from google-auth' to check for available client certificates."
270-
echo "3. If certificates are present, use 'session.configure_mtls_channel()'."
271-
echo "4. Dynamically select the '.mtls.' variant of the endpoint when mTLS is active."
272-
exit 1
273-
else
274-
echo "✅ All hardcoded endpoints have corresponding mTLS definitions or no endpoints found."
275-
fi
276-
fi
190+
source .venv/bin/activate
191+
uv pip install --reinstall-package a2a-sdk 'a2a-sdk>=0.3.4,<0.4'
192+
pytest tests/unittests/a2a \
193+
tests/unittests/agents/test_remote_a2a_agent.py \
194+
tests/unittests/integrations/agent_registry/test_agent_registry.py

.github/workflows/discussion_answering.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ permissions:
2626
jobs:
2727
agent-answer-questions:
2828
if: >-
29+
github.repository == 'google/adk-python' && (
2930
(github.event_name == 'discussion' && github.event.discussion.category.name == 'Q&A') ||
3031
(github.event_name == 'discussion_comment' && contains(github.event.comment.body, '@adk-bot') && github.event.sender.login != 'adk-bot')
32+
)
3133
runs-on: ubuntu-latest
3234

3335
steps:
@@ -63,9 +65,7 @@ jobs:
6365
REPO: 'adk-python'
6466
INTERACTIVE: 0
6567
PYTHONPATH: contributing/samples/adk_team
68+
DISCUSSION_JSON: ${{ toJson(github.event.discussion) }}
6669
run: |
67-
# Write discussion data to temporary file to avoid secret masking issues
68-
cat > /tmp/discussion.json << 'EOF'
69-
${{ toJson(github.event.discussion) }}
70-
EOF
70+
python -c "import os; open('/tmp/discussion.json', 'w').write(os.environ['DISCUSSION_JSON'])"
7171
python -m adk_answering_agent.main --discussion-file /tmp/discussion.json

.github/workflows/release-cherry-pick.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ on:
3434

3535
jobs:
3636
cherry-pick:
37+
if: github.repository == 'google/adk-python'
3738
runs-on: ubuntu-latest
3839
steps:
3940
- name: Determine Branch Configurations

.github/workflows/release-cut.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ permissions:
4747

4848
jobs:
4949
cut-or-regenerate:
50+
if: github.repository == 'google/adk-python'
5051
runs-on: ubuntu-latest
5152
steps:
5253
- name: Determine Branch Configurations
@@ -101,9 +102,54 @@ jobs:
101102

102103
# Run Release Please
103104
- name: Run Release Please
105+
id: release_please
104106
uses: googleapis/release-please-action@v4
105107
with:
106108
token: ${{ secrets.RELEASE_PAT }}
107109
config-file: ${{ steps.config.outputs.config_file }}
108110
manifest-file: ${{ steps.config.outputs.manifest_file }}
109111
target-branch: ${{ steps.config.outputs.candidate_branch }}
112+
113+
# Curate the changelog: draft a Highlights section on top of the
114+
# release-please output and commit it back to the release PR branch. The
115+
# script falls back to an empty Highlights template if drafting fails, so
116+
# this step never blocks the release.
117+
- name: Set up Python
118+
if: steps.release_please.outputs.prs_created == 'true'
119+
uses: actions/setup-python@v6
120+
with:
121+
python-version: '3.11'
122+
123+
- name: Install changelog curation dependencies
124+
if: steps.release_please.outputs.prs_created == 'true'
125+
run: pip install --upgrade google-genai
126+
127+
- name: Curate changelog Highlights
128+
if: steps.release_please.outputs.prs_created == 'true'
129+
# Curation is a nice-to-have layered on top of the release PR; never let
130+
# it turn the release run red (e.g. a push race or a transient error).
131+
continue-on-error: true
132+
env:
133+
RELEASE_PR: ${{ steps.release_please.outputs.pr }}
134+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
135+
GOOGLE_GENAI_USE_VERTEXAI: '0'
136+
GH_TOKEN: ${{ secrets.RELEASE_PAT }}
137+
run: |
138+
set -euo pipefail
139+
PR_BRANCH=$(echo "$RELEASE_PR" | jq -r '.headBranchName')
140+
echo "Curating changelog on release PR branch: $PR_BRANCH"
141+
git fetch origin "$PR_BRANCH"
142+
git checkout -B "$PR_BRANCH" FETCH_HEAD
143+
python scripts/curate_changelog.py --changelog CHANGELOG.md
144+
if git diff --quiet -- CHANGELOG.md; then
145+
echo "No changelog changes to commit."
146+
exit 0
147+
fi
148+
USER_JSON=$(gh api user)
149+
git config user.name "$(echo "$USER_JSON" | jq -r '.login')"
150+
git config user.email "$(echo "$USER_JSON" | jq -r '.id')+$(echo "$USER_JSON" | jq -r '.login')@users.noreply.github.com"
151+
git add CHANGELOG.md
152+
git commit -m "chore: add curated highlights to changelog"
153+
# Rebase onto any concurrent PR-branch updates so the push doesn't fail on a stale ref.
154+
git pull --rebase origin "$PR_BRANCH"
155+
git push origin "$PR_BRANCH"

.github/workflows/release-finalize.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ permissions:
2929

3030
jobs:
3131
finalize:
32-
if: github.event.pull_request.merged == true
32+
if: github.event.pull_request.merged == true && github.repository == 'google/adk-python'
3333
runs-on: ubuntu-latest
3434
steps:
3535
- name: Check for release-please PR

0 commit comments

Comments
 (0)