Skip to content

Commit f8137dc

Browse files
fix: return input-required status when agent needs clarification (#755)
* fix: bump a2a version to latest and simplify the long running tool * fix: update python agent ordering * fix: linter issues
1 parent fa26f96 commit f8137dc

File tree

20 files changed

+2673
-2402
lines changed

20 files changed

+2673
-2402
lines changed

agent_starter_pack/agents/adk_a2a/.template/templateconfig.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ example_question: "What's the weather in San Francisco?"
1717
settings:
1818
requires_data_ingestion: false
1919
deployment_targets: ["agent_engine", "cloud_run"]
20-
extra_dependencies: ["google-adk>=1.16.0,<2.0.0", "a2a-sdk~=0.3.9", "nest-asyncio>=1.6.0,<2.0.0"]
20+
extra_dependencies: ["google-adk>=1.16.0,<2.0.0", "a2a-sdk~=0.3.22", "nest-asyncio>=1.6.0,<2.0.0"]
2121
tags: ["adk", "a2a"]
2222
frontend_type: "None"

agent_starter_pack/agents/adk_a2a/app/agent.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from google.adk.agents import Agent
2020
from google.adk.apps import App
2121
from google.adk.models import Gemini
22+
from google.adk.tools import LongRunningFunctionTool
2223
from google.genai import types
2324
{%- if not cookiecutter.use_google_api_key %}
2425

@@ -65,6 +66,18 @@ def get_current_time(query: str) -> str:
6566
return f"The current time for query {query} is {now.strftime('%Y-%m-%d %H:%M:%S %Z%z')}"
6667

6768

69+
def request_user_input(message: str) -> dict:
70+
"""Request additional input from the user.
71+
72+
Use this tool when you need more information from the user to complete a task.
73+
Calling this tool will pause execution until the user responds.
74+
75+
Args:
76+
message: The question or clarification request to show the user.
77+
"""
78+
return {"status": "pending", "message": message}
79+
80+
6881
root_agent = Agent(
6982
name="root_agent",
7083
model=Gemini(
@@ -73,7 +86,11 @@ def get_current_time(query: str) -> str:
7386
),
7487
description="An agent that can provide information about the weather and time.",
7588
instruction="You are a helpful AI assistant designed to provide accurate and useful information.",
76-
tools=[get_weather, get_current_time],
89+
tools=[
90+
get_weather,
91+
get_current_time,
92+
LongRunningFunctionTool(func=request_user_input),
93+
],
7794
)
7895

7996
app = App(root_agent=root_agent, name="{{cookiecutter.agent_directory}}")

agent_starter_pack/base_templates/python/.cloudbuild/staging.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ steps:
210210
- |
211211
export _ID_TOKEN=$(cat id_token.txt)
212212
export _STAGING_URL=$(cat staging_url.txt)
213-
pip install locust==2.31.1{%- if cookiecutter.is_a2a %} a2a-sdk~=0.3.9{%- endif %} --user
213+
pip install locust==2.31.1{%- if cookiecutter.is_a2a %} a2a-sdk~=0.3.22{%- endif %} --user
214214
locust -f tests/load_test/load_test.py \
215215
--headless \
216216
-H $$_STAGING_URL \

agent_starter_pack/base_templates/python/.github/workflows/staging.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ jobs:
199199
{%- elif cookiecutter.deployment_target == 'cloud_run' %}
200200
export _ID_TOKEN="{% raw %}${{ steps.fetch-token.outputs._id_token }}{% endraw %}"
201201
export _STAGING_URL="{% raw %}${{ steps.fetch-url.outputs._staging_url }}{% endraw %}"
202-
pip install locust==2.31.1{%- if cookiecutter.is_a2a %} a2a-sdk~=0.3.9{%- endif %}
202+
pip install locust==2.31.1{%- if cookiecutter.is_a2a %} a2a-sdk~=0.3.22{%- endif %}
203203
locust -f tests/load_test/load_test.py \
204204
--headless \
205205
-H ${_STAGING_URL} \

agent_starter_pack/cli/utils/template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def get_available_agents(deployment_target: str | None = None) -> dict:
404404
"adk_a2a": 1,
405405
"adk_live": 2,
406406
"agentic_rag": 3,
407-
"langgraph": 0,
407+
"langgraph": 4, # displayed as "custom_a2a"
408408
"adk_go": 0,
409409
"adk_java": 0,
410410
}

agent_starter_pack/deployment_targets/agent_engine/python/{{cookiecutter.agent_directory}}/agent_engine_app.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,11 @@ def clone(self) -> "AgentEngineApp":
172172
{%- else %}
173173
agent_engine = AgentEngineApp(
174174
app=adk_app,
175-
artifact_service_builder=lambda: GcsArtifactService(bucket_name=logs_bucket_name)
176-
if logs_bucket_name
177-
else InMemoryArtifactService(),
175+
artifact_service_builder=lambda: (
176+
GcsArtifactService(bucket_name=logs_bucket_name)
177+
if logs_bucket_name
178+
else InMemoryArtifactService()
179+
),
178180
)
179181
{%- endif -%}
180182
{% else %}

agent_starter_pack/deployment_targets/cloud_run/python/tests/load_test/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ uv run uvicorn {{cookiecutter.agent_directory}}.fast_api_app:app --host 0.0.0.0
9999
Using another terminal tab, This is suggested to avoid conflicts with the existing application python environment.
100100

101101
```bash
102-
python3 -m venv .locust_env && source .locust_env/bin/activate && pip install locust==2.31.1{%- if cookiecutter.is_a2a %} a2a-sdk~=0.3.9{%- endif %}
102+
python3 -m venv .locust_env && source .locust_env/bin/activate && pip install locust==2.31.1{%- if cookiecutter.is_a2a %} a2a-sdk~=0.3.22{%- endif %}
103103
```
104104
105105
**3. Execute the Load Test:**
@@ -150,7 +150,7 @@ export _ID_TOKEN=$(gcloud auth print-identity-token -q)
150150
**3. Execute the Load Test:**
151151
Create virtual environment with Locust:
152152
```bash
153-
python3 -m venv .locust_env && source .locust_env/bin/activate && pip install locust==2.31.1{%- if cookiecutter.is_a2a %} a2a-sdk~=0.3.9{%- endif %}
153+
python3 -m venv .locust_env && source .locust_env/bin/activate && pip install locust==2.31.1{%- if cookiecutter.is_a2a %} a2a-sdk~=0.3.22{%- endif %}
154154
```
155155
156156
Execute load tests. The following command executes the same load test parameters as the local test but targets your remote Cloud Run instance.

0 commit comments

Comments
 (0)