Skip to content

Commit aaff26d

Browse files
authored
Merge branch 'main' into main
2 parents 36f8793 + 18d1954 commit aaff26d

30 files changed

+578
-173
lines changed

.github/actions/spelling/allow.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ npx
5151
oauthoidc
5252
openbnb
5353
opensource
54+
pyversions
5455
socio
5556
sse
5657
tagwords

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
strategy:
2020
matrix:
21-
python-version: ["3.13"]
21+
python-version: ["3.10", "3.13"]
2222

2323
steps:
2424
- name: Checkout code
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Update A2A Schema from Specification
2+
3+
on:
4+
repository_dispatch:
5+
types: [a2a_json_update]
6+
workflow_dispatch:
7+
8+
jobs:
9+
generate_and_pr:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.10"
23+
24+
- name: Install uv
25+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
26+
27+
- name: Configure uv shell
28+
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
29+
30+
- name: Install dependencies (datamodel-code-generator)
31+
run: uv sync
32+
33+
- name: Define output file variable
34+
id: vars
35+
run: |
36+
GENERATED_FILE="./src/a2a/types.py"
37+
echo "GENERATED_FILE=$GENERATED_FILE" >> "$GITHUB_OUTPUT"
38+
39+
- name: Run datamodel-codegen
40+
run: |
41+
set -euo pipefail # Exit immediately if a command exits with a non-zero status
42+
43+
REMOTE_URL="https://raw.githubusercontent.com/google/A2A/refs/heads/main/specification/json/a2a.json"
44+
GENERATED_FILE="${{ steps.vars.outputs.GENERATED_FILE }}"
45+
46+
echo "Running datamodel-codegen..."
47+
uv run datamodel-codegen \
48+
--url "$REMOTE_URL" \
49+
--input-file-type jsonschema \
50+
--output "$GENERATED_FILE" \
51+
--target-python-version 3.10 \
52+
--output-model-type pydantic_v2.BaseModel \
53+
--disable-timestamp \
54+
--use-schema-description \
55+
--use-union-operator \
56+
--use-field-description \
57+
--use-default \
58+
--use-default-kwarg \
59+
--use-one-literal-as-default \
60+
--class-name A2A \
61+
--use-standard-collections
62+
echo "Codegen finished."
63+
64+
- name: Create Pull Request with Updates
65+
uses: peter-evans/create-pull-request@v6
66+
with:
67+
token: ${{ secrets.A2A_BOT_PAT }}
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"
72+
body: |
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 }}"
75+
base: main
76+
labels: |
77+
automated
78+
dependencies
79+
add-paths: ${{ steps.vars.outputs.GENERATED_FILE }}

.ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
line-length = 80 # Google Style Guide §3.2: 80 columns
1010
indent-width = 4 # Google Style Guide §3.4: 4 spaces
1111

12-
target-version = "py313" # Minimum Python version
12+
target-version = "py310" # Minimum Python version
1313

1414
[lint]
1515
ignore = [

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## [0.2.4](https://github.com/google/a2a-python/compare/v0.2.3...v0.2.4) (2025-05-22)
4+
5+
6+
### Features
7+
8+
* Update to support python 3.10 ([#85](https://github.com/google/a2a-python/issues/85)) ([fd9c3b5](https://github.com/google/a2a-python/commit/fd9c3b5b0bbef509789a701171d95f690c84750b))
9+
10+
11+
### Bug Fixes
12+
13+
* Throw exception for task_id mismatches ([#70](https://github.com/google/a2a-python/issues/70)) ([a9781b5](https://github.com/google/a2a-python/commit/a9781b589075280bfaaab5742d8b950916c9de74))
14+
315
## [0.2.3](https://github.com/google/a2a-python/compare/v0.2.2...v0.2.3) (2025-05-20)
416

517

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
# A2A Python SDK
22

3-
A Python library that helps run agentic applications as A2AServers following the [Agent2Agent (A2A) Protocol](https://google.github.io/A2A/).
3+
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
4+
![PyPI - Version](https://img.shields.io/pypi/v/a2a-sdk)
5+
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/a2a-sdk)
6+
7+
<!-- markdownlint-disable no-inline-html -->
8+
9+
<html>
10+
<h2 align="center">
11+
<img src="https://raw.githubusercontent.com/google/A2A/refs/heads/main/docs/assets/a2a-logo-black.svg" width="256" alt="A2A Logo"/>
12+
</h2>
13+
<h3 align="center">A Python library that helps run agentic applications as A2AServers following the <a href="https://google.github.io/A2A">Agent2Agent (A2A) Protocol</a>.</h3>
14+
</html>
15+
16+
<!-- markdownlint-enable no-inline-html -->
417

518
## Installation
619

720
You can install the A2A SDK using either `uv` or `pip`.
821

922
## Prerequisites
1023

11-
- Python 3.13+
24+
- Python 3.10+
1225
- `uv` (optional, but recommended) or `pip`
1326

1427
### Using `uv`

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
)

0 commit comments

Comments
 (0)