Skip to content

Commit 5b7e1f3

Browse files
authored
Merge branch 'main' into md-authagentcard
2 parents 1490d7e + 18d1954 commit 5b7e1f3

File tree

20 files changed

+267
-128
lines changed

20 files changed

+267
-128
lines changed

.github/workflows/update-a2a-types.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: Update A2A Schema from Specification
22

33
on:
4-
schedule:
5-
- cron: "0 0 * * *" # Runs daily at 00:00 UTC
4+
repository_dispatch:
5+
types: [a2a_json_update]
66
workflow_dispatch:
77

88
jobs:
9-
check_and_update:
9+
generate_and_pr:
1010
runs-on: ubuntu-latest
1111
permissions:
1212
contents: write
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Python
2020
uses: actions/setup-python@v5
2121
with:
22-
python-version: "3.13"
22+
python-version: "3.10"
2323

2424
- name: Install uv
2525
run: curl -LsSf https://astral.sh/uv/install.sh | sh
@@ -61,20 +61,17 @@ jobs:
6161
--use-standard-collections
6262
echo "Codegen finished."
6363
64-
- name: Create Pull Request if generated file changed
64+
- name: Create Pull Request with Updates
6565
uses: peter-evans/create-pull-request@v6
6666
with:
6767
token: ${{ secrets.A2A_BOT_PAT }}
68-
committer: a2a-bot <[email protected]>
69-
author: a2a-bot <[email protected]>
70-
commit-message: "chore: 🤖 Auto-update A2A schema from specification"
71-
title: "chore: 🤖 Auto-update A2A Schema from Specification"
68+
committer: "a2a-bot <[email protected]>"
69+
author: "a2a-bot <[email protected]>"
70+
commit-message: "chore: 🤖Auto-update A2A types from google/A2A@${{ github.event.client_payload.sha }}"
71+
title: "chore: 🤖 Auto-update A2A types from google/A2A"
7272
body: |
73-
This PR automatically updates the A2A schema types based on the latest specification.
74-
75-
This update was triggered by the scheduled workflow run.
76-
See the workflow run details: [${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
77-
branch: "a2a-schema-update"
73+
This PR updates `src/a2a/types.py` based on the latest `specification/json/a2a.json` from [google/A2A](https://github.com/google/A2A/commit/${{ github.event.client_payload.sha }}).
74+
branch: "auto-update-a2a-types-${{ github.event.client_payload.sha }}"
7875
base: main
7976
labels: |
8077
automated

examples/google_adk/birthday_planner/adk_agent_executor.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,10 @@ async def _process_request(
156156
session_id: str,
157157
task_updater: TaskUpdater,
158158
) -> AsyncIterable[TaskStatus | Artifact]:
159-
session_id = self._upsert_session(
159+
session = await self._upsert_session(
160160
session_id,
161-
).id
161+
)
162+
session_id = session.id
162163
async for event in self._run_agent(
163164
session_id, new_message, task_updater
164165
):
@@ -243,10 +244,10 @@ async def cancel(self, context: RequestContext, event_queue: EventQueue):
243244
# Ideally: kill any ongoing tasks.
244245
raise ServerError(error=UnsupportedOperationError())
245246

246-
def _upsert_session(self, session_id: str):
247-
return self.runner.session_service.get_session(
247+
async def _upsert_session(self, session_id: str):
248+
return await self.runner.session_service.get_session(
248249
app_name=self.runner.app_name, user_id='self', session_id=session_id
249-
) or self.runner.session_service.create_session(
250+
) or await self.runner.session_service.create_session(
250251
app_name=self.runner.app_name, user_id='self', session_id=session_id
251252
)
252253

examples/google_adk/birthday_planner/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ name = "adk-a2a-client-example"
33
version = "0.1.0"
44
description = "Birthday planner agent example"
55
readme = "README.md"
6-
requires-python = ">=3.10"
6+
requires-python = ">=3.12"
77
dependencies = [
88
"a2a-sdk",
99
"click>=8.1.8",
1010
"dotenv>=0.9.9",
1111
"httpx>=0.28.1",
1212
"google-genai>=1.9.0",
13-
"google-adk>=0.0.3",
13+
"google-adk>=1.0.0",
1414
"pydantic>=2.11.4",
1515
"python-dotenv>=1.1.0",
1616
]

examples/google_adk/calendar_agent/__main__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import asyncio
12
import logging
23
import os
34

@@ -66,10 +67,10 @@ def main(host: str, port: int):
6667
skills=[skill],
6768
)
6869

69-
adk_agent = create_agent(
70+
adk_agent = asyncio.run(create_agent(
7071
client_id=os.getenv('GOOGLE_CLIENT_ID'),
7172
client_secret=os.getenv('GOOGLE_CLIENT_SECRET'),
72-
)
73+
))
7374
runner = Runner(
7475
app_name=agent_card.name,
7576
agent=adk_agent,

examples/google_adk/calendar_agent/adk_agent.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import datetime
22

33
from google.adk.agents import LlmAgent # type: ignore[import-untyped]
4-
from google.adk.tools.google_api_tool import calendar_tool_set # type: ignore[import-untyped]
4+
from google.adk.tools.google_api_tool import CalendarToolset # type: ignore[import-untyped]
55

66

7-
def create_agent(client_id, client_secret) -> LlmAgent:
7+
async def create_agent(client_id, client_secret) -> LlmAgent:
88
"""Constructs the ADK agent."""
9-
calendar_tool_set.configure_auth(client_id, client_secret)
9+
toolset = CalendarToolset(client_id=client_id, client_secret=client_secret)
1010
return LlmAgent(
1111
model='gemini-2.0-flash-001',
1212
name='calendar_agent',
@@ -23,5 +23,5 @@ def create_agent(client_id, client_secret) -> LlmAgent:
2323
2424
Today is {datetime.datetime.now()}.
2525
""",
26-
tools=calendar_tool_set.get_tools(),
26+
tools=await toolset.get_tools(),
2727
)

examples/google_adk/calendar_agent/adk_agent_executor.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ async def _process_request(
6565
session_id: str,
6666
task_updater: TaskUpdater,
6767
) -> None:
68-
session_id = self._upsert_session(
68+
session = await self._upsert_session(
6969
session_id,
70-
).id
70+
)
71+
session_id = session.id
7172
auth_details = None
7273
async for event in self._run_agent(session_id, new_message):
7374
# This agent is expected to do one of two things:
@@ -229,10 +230,10 @@ async def cancel(self, context: RequestContext, event_queue: EventQueue):
229230
async def on_auth_callback(self, state: str, uri: str):
230231
self._awaiting_auth[state].set_result(uri)
231232

232-
def _upsert_session(self, session_id: str):
233-
return self.runner.session_service.get_session(
233+
async def _upsert_session(self, session_id: str):
234+
return await self.runner.session_service.get_session(
234235
app_name=self.runner.app_name, user_id='self', session_id=session_id
235-
) or self.runner.session_service.create_session(
236+
) or await self.runner.session_service.create_session(
236237
app_name=self.runner.app_name, user_id='self', session_id=session_id
237238
)
238239

@@ -317,7 +318,7 @@ def get_auth_config(
317318
) -> AuthConfig:
318319
"""Extracts the AuthConfig object from the arguments of the auth request function call."""
319320
if not auth_request_function_call.args or not (
320-
auth_config := auth_request_function_call.args.get('auth_config')
321+
auth_config := auth_request_function_call.args.get('authConfig')
321322
):
322323
raise ValueError(
323324
f'Cannot get auth config from function call: {auth_request_function_call}'

examples/google_adk/calendar_agent/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ name = "adk-auth-example"
33
version = "0.1.0"
44
description = "Calendar agent example"
55
readme = "README.md"
6-
requires-python = ">=3.10"
6+
requires-python = ">=3.12"
77
dependencies = [
88
"a2a-sdk",
99
"click>=8.1.8",
1010
"dotenv>=0.9.9",
1111
"httpx>=0.28.1",
1212
"google-genai>=1.9.0",
13-
"google-adk>=0.0.3",
13+
"google-adk>=1.0.0",
1414
"pydantic>=2.11.4",
1515
"python-dotenv>=1.1.0",
1616
"uvicorn>=0.34.2",

src/a2a/server/agent_execution/context.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import uuid
22

3+
from a2a.server.context import ServerCallContext
34
from a2a.types import (
45
InvalidParamsError,
56
Message,
@@ -26,6 +27,7 @@ def __init__(
2627
context_id: str | None = None,
2728
task: Task | None = None,
2829
related_tasks: list[Task] | None = None,
30+
call_context: ServerCallContext | None = None,
2931
):
3032
"""Initializes the RequestContext.
3133
@@ -43,6 +45,7 @@ def __init__(
4345
self._context_id = context_id
4446
self._current_task = task
4547
self._related_tasks = related_tasks
48+
self._call_context = call_context
4649
# If the task id and context id were provided, make sure they
4750
# match the request. Otherwise, create them
4851
if self._params:
@@ -125,6 +128,11 @@ def configuration(self) -> MessageSendConfiguration | None:
125128
return None
126129
return self._params.configuration
127130

131+
@property
132+
def call_context(self) -> ServerCallContext | None:
133+
"""The server call context associated with this request."""
134+
return self._call_context
135+
128136
def _check_or_generate_task_id(self) -> None:
129137
"""Ensures a task ID is present, generating one if necessary."""
130138
if not self._params:

src/a2a/server/agent_execution/request_context_builder.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from abc import ABC, abstractmethod
22

33
from a2a.server.agent_execution import RequestContext
4+
from a2a.server.context import ServerCallContext
45
from a2a.types import MessageSendParams, Task
56

67

@@ -14,5 +15,6 @@ async def build(
1415
task_id: str | None = None,
1516
context_id: str | None = None,
1617
task: Task | None = None,
18+
context: ServerCallContext | None = None,
1719
) -> RequestContext:
1820
pass

src/a2a/server/agent_execution/simple_request_context_builder.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import asyncio
22

33
from a2a.server.agent_execution import RequestContext, RequestContextBuilder
4+
from a2a.server.context import ServerCallContext
45
from a2a.server.tasks import TaskStore
56
from a2a.types import MessageSendParams, Task
67

@@ -22,6 +23,7 @@ async def build(
2223
task_id: str | None = None,
2324
context_id: str | None = None,
2425
task: Task | None = None,
26+
context: ServerCallContext | None = None,
2527
) -> RequestContext:
2628
related_tasks: list[Task] | None = None
2729

@@ -45,4 +47,5 @@ async def build(
4547
context_id=context_id,
4648
task=task,
4749
related_tasks=related_tasks,
50+
call_context=context,
4851
)

0 commit comments

Comments
 (0)