Skip to content

Commit 4e718c8

Browse files
authored
Merge branch 'main' into test/add-planners-unit-tests
2 parents 274eb3b + c910961 commit 4e718c8

88 files changed

Lines changed: 7253 additions & 4549 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.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
cherry-pick:
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v6
2222
with:
2323
ref: release/candidate
2424
fetch-depth: 0

.github/workflows/release-cut.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
cut-release:
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v6
2222
with:
2323
ref: ${{ inputs.commit_sha || 'main' }}
2424

.github/workflows/release-finalize.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
echo "is_release_pr=false" >> $GITHUB_OUTPUT
3030
fi
3131
32-
- uses: actions/checkout@v4
32+
- uses: actions/checkout@v6
3333
if: steps.check.outputs.is_release_pr == 'true'
3434
with:
3535
ref: release/candidate

.github/workflows/release-please.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
echo "exists=false" >> $GITHUB_OUTPUT
2828
fi
2929
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v6
3131
if: steps.check.outputs.exists == 'true'
3232
with:
3333
ref: release/candidate

.github/workflows/release-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
echo "version=$VERSION" >> $GITHUB_OUTPUT
2929
echo "Publishing version: $VERSION"
3030
31-
- uses: actions/checkout@v4
31+
- uses: actions/checkout@v6
3232

3333
- name: Install uv
3434
uses: astral-sh/setup-uv@v4

contributing/samples/gepa/OWNERS

Lines changed: 0 additions & 3 deletions
This file was deleted.

contributing/samples/skills_agent_gcs/agent.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,20 @@
1414

1515
"""Example agent demonstrating the use of SkillToolset with GCS.
1616
17+
Set the following environment variables before running:
18+
SAMPLE_SKILLS_SANDBOX_RESOURCE_NAME="projects/{PROJECT_NUMBER}/locations/{LOCATION}/reasoningEngines/{ENGINE_ID}/sandboxEnvironments/{SANDBOX_ID}"
19+
SAMPLE_SKILLS_AGENT_ENGINE_RESOURCE_NAME="projects/{PROJECT_NUMBER}/locations/{LOCATION}/reasoningEngines/{ENGINE_ID}"
20+
1721
Go to parent directory and run with `adk web --host=0.0.0.0`.
1822
"""
1923

2024
import asyncio
2125
import logging
26+
import os
2227

2328
from google.adk import Agent
2429
from google.adk import Runner
30+
from google.adk.code_executors.agent_engine_sandbox_code_executor import AgentEngineSandboxCodeExecutor
2531
from google.adk.plugins import LoggingPlugin
2632
from google.adk.skills import list_skills_in_gcs_dir
2733
from google.adk.skills import load_skill_from_gcs_dir
@@ -62,6 +68,12 @@
6268
tools=[
6369
my_skill_toolset,
6470
],
71+
code_executor=AgentEngineSandboxCodeExecutor(
72+
sandbox_resource_name=os.getenv("SAMPLE_SKILLS_SANDBOX_RESOURCE_NAME"),
73+
agent_engine_resource_name=os.getenv(
74+
"SAMPLE_SKILLS_AGENT_ENGINE_RESOURCE_NAME"
75+
),
76+
),
6577
)
6678

6779

scripts/unittests.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ restore_venv() {
5858
deactivate
5959
fi
6060

61-
if [[ -d ".unittest_venv" ]]; then
62-
echo "Cleaning up .unittest_venv..."
63-
rm -rf .unittest_venv
64-
fi
61+
echo "Cleaning up temporary directories..."
62+
[[ -n "${VENV_DIR:-}" ]] && rm -rf "$VENV_DIR"
63+
[[ -n "${UV_CACHE_DIR:-}" ]] && rm -rf "$UV_CACHE_DIR"
6564

6665
if [[ -n "$ORIGINAL_VENV" ]]; then
6766
echo "Reactivating pre-existing venv: $ORIGINAL_VENV"
@@ -72,6 +71,15 @@ restore_venv() {
7271
# Ensure the environment is restored when the script exits.
7372
trap restore_venv EXIT
7473

74+
# Temporary directory for the virtual environment.
75+
VENV_DIR=$(mktemp -d "${TMPDIR:-/tmp}/unittest_venv.XXXXXX")
76+
77+
# Move uv cache to temp to prevent workspace bloat and IDE performance issues.
78+
export UV_CACHE_DIR=$(mktemp -d "${TMPDIR:-/tmp}/uv_cache.XXXXXX")
79+
80+
# Force 'copy' mode; hardlinks (uv default) fail on many virtual filesystems.
81+
export UV_LINK_MODE=copy
82+
7583
# 1. deactivate the current venv
7684
if [[ -n "${VIRTUAL_ENV:-}" ]]; then
7785
echo "Deactivating current venv: $VIRTUAL_ENV"
@@ -88,12 +96,12 @@ for version in "${versions_to_run[@]}"; do
8896
echo "=================================================="
8997

9098
# 2. create a unittest_venv just for unit tests
91-
echo "Creating/Using unittest_venv for python${version} in .unittest_venv..."
92-
uv venv --python "${version}" .unittest_venv --clear
93-
source .unittest_venv/bin/activate
99+
echo "Creating/Using unittest_venv for python${version} in $VENV_DIR..."
100+
uv venv --python "${version}" "$VENV_DIR" --clear
101+
source "$VENV_DIR/bin/activate"
94102

95103
# 3. perform the unit tests
96-
echo "Setting up test environment in .unittest_venv..."
104+
echo "Setting up test environment in $VENV_DIR..."
97105
uv sync --extra test --active
98106

99107
echo "Running unit tests..."

src/google/adk/agents/base_agent.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ class MyAgent(BaseAgent):
136136
sub_agents: list[BaseAgent] = Field(default_factory=list)
137137
"""The sub-agents of this agent."""
138138

139+
version: str = ''
140+
"""The agent's version.
141+
142+
Version of the agent being invoked. Used to identify the Agent involved in telemetry.
143+
"""
144+
139145
before_agent_callback: Optional[BeforeAgentCallback] = None
140146
"""Callback or list of callbacks to be invoked before the agent run.
141147
@@ -680,6 +686,7 @@ def __create_kwargs(
680686

681687
kwargs: Dict[str, Any] = {
682688
'name': config.name,
689+
'version': config.version,
683690
'description': config.description,
684691
}
685692
if config.sub_agents:

src/google/adk/agents/base_agent_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ class BaseAgentConfig(BaseModel):
5555

5656
name: str = Field(description='Required. The name of the agent.')
5757

58+
version: str = Field(
59+
default='', description='Optional. The version of the agent.'
60+
)
61+
5862
description: str = Field(
5963
default='', description='Optional. The description of the agent.'
6064
)

0 commit comments

Comments
 (0)