Skip to content

Commit a0d90de

Browse files
authored
Merge branch 'main' into fix/node-runner-state-delta
2 parents d330699 + e623b3b commit a0d90de

4 files changed

Lines changed: 45 additions & 8 deletions

File tree

.github/workflows/check-file-contents.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,37 @@ jobs:
100100
else
101101
echo "✅ No relevant Python files found."
102102
fi
103+
104+
- name: Check for hardcoded googleapis.com endpoints
105+
run: |
106+
git fetch origin ${GITHUB_BASE_REF}
107+
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${GITHUB_BASE_REF}...HEAD | grep -E '\.py$' || true)
108+
if [ -n "$CHANGED_FILES" ]; then
109+
echo "Checking for hardcoded endpoints in: $CHANGED_FILES"
110+
111+
# 1. Identify files containing any googleapis.com URL.
112+
set +e
113+
FILES_WITH_ENDPOINTS=$(grep -lE 'https?://[a-zA-Z0-9.-]+\.googleapis\.com' $CHANGED_FILES)
114+
115+
# 2. From those, identify files that are MISSING the required mTLS version.
116+
if [ -n "$FILES_WITH_ENDPOINTS" ]; then
117+
FILES_MISSING_MTLS=$(grep -L '.mtls.googleapis.com' $FILES_WITH_ENDPOINTS)
118+
fi
119+
set -e
120+
121+
if [ -n "$FILES_MISSING_MTLS" ]; then
122+
echo "❌ Found hardcoded googleapis.com endpoints without mTLS support."
123+
echo "The following files must define both standard and mTLS (.mtls.googleapis.com) endpoints"
124+
echo "to support dynamic endpoint selection as required by security policy:"
125+
echo "$FILES_MISSING_MTLS"
126+
echo ""
127+
echo "To fix this, please follow these steps:"
128+
echo "1. Initialize an AuthorizedSession with your credentials."
129+
echo "2. Use 'mtls.has_default_client_cert_source() from google-auth' to check for available client certificates."
130+
echo "3. If certificates are present, use 'session.configure_mtls_channel()'."
131+
echo "4. Dynamically select the '.mtls.' variant of the endpoint when mTLS is active."
132+
exit 1
133+
else
134+
echo "✅ All hardcoded endpoints have corresponding mTLS definitions or no endpoints found."
135+
fi
136+
fi

.github/workflows/python-unit-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ permissions:
1212
jobs:
1313
test:
1414
runs-on: ubuntu-latest
15+
timeout-minutes: 10
1516
strategy:
1617
matrix:
1718
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

src/google/adk/cli/api_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ async def get_adk_app_info(app_name: str) -> AppInfo:
10431043
root_agent_name=root_agent.name,
10441044
description=root_agent.description,
10451045
language="python",
1046-
agents=get_agents_dict(root_agent),
1046+
agents=await get_agents_dict(root_agent),
10471047
)
10481048
else:
10491049
raise HTTPException(

src/google/adk/utils/agent_info.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@ class AgentInfo(pydantic.BaseModel):
3434
sub_agents: list[str]
3535

3636

37-
def get_tools_info(tools: list[ToolUnion]) -> list[Any]:
37+
async def get_tools_info(tools: list[ToolUnion]) -> list[Any]:
3838
"""Returns the info for a given list of tools."""
3939
final_tools = []
4040
for tool in tools:
4141
if isinstance(tool, BaseTool):
4242
final_tools.append(tool)
4343
elif isinstance(tool, BaseToolset):
44-
final_tools.extend(tool.get_tools())
44+
# Await the async coroutine call natively!
45+
tools_res = await tool.get_tools()
46+
final_tools.extend(tools_res)
4547
else:
4648
final_tools.append(FunctionTool(tool))
4749
return [
@@ -51,27 +53,27 @@ def get_tools_info(tools: list[ToolUnion]) -> list[Any]:
5153
]
5254

5355

54-
def get_agents_dict(agent: LlmAgent) -> dict[str, AgentInfo]:
56+
async def get_agents_dict(agent: LlmAgent) -> dict[str, AgentInfo]:
5557
"""Returns a dict with info for the agent and its sub-agents."""
5658
agents_dict = {}
5759

58-
def _traverse(current_agent: LlmAgent):
60+
async def _traverse(current_agent: LlmAgent):
5961
if current_agent.name in agents_dict:
6062
return
6163

6264
sub_agent_names = []
6365
for sub_agent in current_agent.sub_agents:
6466
if isinstance(sub_agent, LlmAgent):
65-
_traverse(sub_agent)
67+
await _traverse(sub_agent)
6668
sub_agent_names.append(sub_agent.name)
6769

6870
agents_dict[current_agent.name] = AgentInfo(
6971
name=current_agent.name,
7072
description=current_agent.description,
7173
instruction=current_agent.instruction,
72-
tools=get_tools_info(current_agent.tools),
74+
tools=await get_tools_info(current_agent.tools),
7375
sub_agents=sub_agent_names,
7476
)
7577

76-
_traverse(agent)
78+
await _traverse(agent)
7779
return agents_dict

0 commit comments

Comments
 (0)