Skip to content

Commit 7d1adcf

Browse files
authored
Merge branch 'main' into feat/client-send-message-config-merge
2 parents 91781f9 + dbc73e8 commit 7d1adcf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1912
-647
lines changed

.github/workflows/linter.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
with:
1919
python-version-file: .python-version
2020
- name: Install uv
21-
uses: astral-sh/setup-uv@v6
21+
uses: astral-sh/setup-uv@v7
2222
- name: Add uv to PATH
2323
run: |
2424
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

.github/workflows/python-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v5
1616

1717
- name: Install uv
18-
uses: astral-sh/setup-uv@v6
18+
uses: astral-sh/setup-uv@v7
1919

2020
- name: "Set up Python"
2121
uses: actions/setup-python@v6
@@ -26,7 +26,7 @@ jobs:
2626
run: uv build
2727

2828
- name: Upload distributions
29-
uses: actions/upload-artifact@v4
29+
uses: actions/upload-artifact@v5
3030
with:
3131
name: release-dists
3232
path: dist/
@@ -40,7 +40,7 @@ jobs:
4040

4141
steps:
4242
- name: Retrieve release distributions
43-
uses: actions/download-artifact@v5
43+
uses: actions/download-artifact@v6
4444
with:
4545
name: release-dists
4646
path: dist/

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
echo "MYSQL_TEST_DSN=mysql+aiomysql://a2a:a2a_password@localhost:3306/a2a_test" >> $GITHUB_ENV
4747
4848
- name: Install uv for Python ${{ matrix.python-version }}
49-
uses: astral-sh/setup-uv@v6
49+
uses: astral-sh/setup-uv@v7
5050
with:
5151
python-version: ${{ matrix.python-version }}
5252
- name: Add uv to PATH

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
with:
1919
python-version: '3.10'
2020
- name: Install uv
21-
uses: astral-sh/setup-uv@v6
21+
uses: astral-sh/setup-uv@v7
2222
- name: Configure uv shell
2323
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
2424
- name: Install dependencies (datamodel-code-generator)

CHANGELOG.md

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

3+
## [0.3.16](https://github.com/a2aproject/a2a-python/compare/v0.3.15...v0.3.16) (2025-11-21)
4+
5+
6+
### Bug Fixes
7+
8+
* Ensure metadata propagation for `Task` `ToProto` and `FromProto` conversion ([#557](https://github.com/a2aproject/a2a-python/issues/557)) ([fc31d03](https://github.com/a2aproject/a2a-python/commit/fc31d03e8c6acb68660f6d1924262e16933c5d50))
9+
10+
## [0.3.15](https://github.com/a2aproject/a2a-python/compare/v0.3.14...v0.3.15) (2025-11-19)
11+
12+
13+
### Features
14+
15+
* Add client-side extension support ([#525](https://github.com/a2aproject/a2a-python/issues/525)) ([9a92bd2](https://github.com/a2aproject/a2a-python/commit/9a92bd238e7560b195165ac5f78742981760525e))
16+
* **rest, jsonrpc:** Add client-side extension support ([9a92bd2](https://github.com/a2aproject/a2a-python/commit/9a92bd238e7560b195165ac5f78742981760525e))
17+
18+
## [0.3.14](https://github.com/a2aproject/a2a-python/compare/v0.3.13...v0.3.14) (2025-11-17)
19+
20+
21+
### Features
22+
23+
* **jsonrpc:** add option to disable oversized payload check in JSONRPC applications ([ba142df](https://github.com/a2aproject/a2a-python/commit/ba142df821d1c06be0b96e576fd43015120fcb0b))
24+
25+
## [0.3.13](https://github.com/a2aproject/a2a-python/compare/v0.3.12...v0.3.13) (2025-11-13)
26+
27+
28+
### Bug Fixes
29+
30+
* return entire history when history_length=0 ([#537](https://github.com/a2aproject/a2a-python/issues/537)) ([acdc0de](https://github.com/a2aproject/a2a-python/commit/acdc0de4fa03d34a6b287ab252ff51b19c3016b5))
31+
32+
## [0.3.12](https://github.com/a2aproject/a2a-python/compare/v0.3.11...v0.3.12) (2025-11-12)
33+
34+
35+
### Bug Fixes
36+
37+
* **grpc:** Add `extensions` to `Artifact` converters. ([#523](https://github.com/a2aproject/a2a-python/issues/523)) ([c03129b](https://github.com/a2aproject/a2a-python/commit/c03129b99a663ae1f1ae72f20e4ead7807ede941))
38+
39+
## [0.3.11](https://github.com/a2aproject/a2a-python/compare/v0.3.10...v0.3.11) (2025-11-07)
40+
41+
42+
### Bug Fixes
43+
44+
* add metadata to send message request ([12b4a1d](https://github.com/a2aproject/a2a-python/commit/12b4a1d565a53794f5b55c8bd1728221c906ed41))
45+
46+
## [0.3.10](https://github.com/a2aproject/a2a-python/compare/v0.3.9...v0.3.10) (2025-10-21)
47+
48+
49+
### Features
50+
51+
* add `get_artifact_text()` helper method ([9155888](https://github.com/a2aproject/a2a-python/commit/9155888d258ca4d047002997e6674f3f15a67232))
52+
* Add a `ClientFactory.connect()` method for easy client creation ([d585635](https://github.com/a2aproject/a2a-python/commit/d5856359034f4d3d1e4578804727f47a3cd7c322))
53+
54+
55+
### Bug Fixes
56+
57+
* change `MAX_CONTENT_LENGTH` (for file attachment) in json-rpc to be larger size (10mb) ([#518](https://github.com/a2aproject/a2a-python/issues/518)) ([5b81385](https://github.com/a2aproject/a2a-python/commit/5b813856b4b4e07510a4ef41980d388e47c73b8e))
58+
* correct `new_artifact` methods signature ([#503](https://github.com/a2aproject/a2a-python/issues/503)) ([ee026aa](https://github.com/a2aproject/a2a-python/commit/ee026aa356042b9eb212eee59fa5135b280a3077))
59+
60+
61+
### Code Refactoring
62+
63+
* **utils:** move part helpers to their own file ([9155888](https://github.com/a2aproject/a2a-python/commit/9155888d258ca4d047002997e6674f3f15a67232))
64+
365
## [0.3.9](https://github.com/a2aproject/a2a-python/compare/v0.3.8...v0.3.9) (2025-10-15)
466

567

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#!/bin/bash
2+
3+
# Exit immediately if a command exits with a non-zero status.
4+
# Treat unset variables as an error.
5+
set -euo pipefail
6+
7+
A2A_SPEC_REPO="https://github.com/a2aproject/A2A.git" # URL for the A2A spec repo.
8+
A2A_SPEC_BRANCH="main" # Name of the branch with experimental changes.
9+
FEATURE_BRANCH="experimental-types" # Name of the feature branch to create.
10+
ROOT_DIR=$(git rev-parse --show-toplevel)
11+
12+
usage() {
13+
cat <<EOF
14+
Usage: $0 [OPTIONS]
15+
16+
Creates a new feature branch with types generated from unmerged A2A spec changes.
17+
18+
This script clones the A2A spec repository, checks out a specific branch,
19+
and creates a new local feature branch from it.
20+
21+
The script requires uv and buf to be installed.
22+
23+
OPTIONS:
24+
-r, --spec-repo URL for the A2A spec repository.
25+
(Default: "$A2A_SPEC_REPO")
26+
27+
-b, --spec-branch Name of the branch with the experimental changes.
28+
(Default: "$A2A_SPEC_BRANCH")
29+
30+
-f, --feature-branch Name of the new feature branch to create.
31+
(Default: "$FEATURE_BRANCH")
32+
33+
-h, --help Display this help message and exit.
34+
35+
EXAMPLE:
36+
# Run with all default settings:
37+
$0
38+
39+
# Run with custom settings:
40+
$0 -r "https://github.com/spec-fork/A2A.git" -b "spec-change" -f "my-branch"
41+
EOF
42+
}
43+
44+
# Handle command-line arguments.
45+
while [[ $# -gt 0 ]]; do
46+
case $1 in
47+
-h|--help)
48+
usage
49+
exit 0
50+
;;
51+
-r|--spec-repo)
52+
A2A_SPEC_REPO="$2"
53+
shift 2
54+
;;
55+
-b|--spec-branch)
56+
A2A_SPEC_BRANCH="$2"
57+
shift 2
58+
;;
59+
-f|--feature-branch)
60+
FEATURE_BRANCH="$2"
61+
shift 2
62+
;;
63+
*)
64+
echo "Error: Unknown option '$1'" >&2
65+
usage
66+
exit 1
67+
;;
68+
esac
69+
done
70+
71+
72+
TMP_WORK_DIR=$(mktemp -d)
73+
echo "Created a temporary working directory: $TMP_WORK_DIR"
74+
trap 'rm -rf -- "$TMP_WORK_DIR"' EXIT
75+
cd $TMP_WORK_DIR
76+
77+
echo "Cloning the \"$A2A_SPEC_REPO\" repository..."
78+
git clone $A2A_SPEC_REPO spec_repo
79+
cd spec_repo
80+
81+
echo "Checking out the \"$A2A_SPEC_BRANCH\" branch..."
82+
git checkout "$A2A_SPEC_BRANCH"
83+
84+
echo "Invoking the generate_types.sh script..."
85+
GENERATED_FILE="$ROOT_DIR/src/a2a/types.py"
86+
$ROOT_DIR/scripts/generate_types.sh "$GENERATED_FILE" --input-file "$TMP_WORK_DIR/spec_repo/specification/json/a2a.json"
87+
88+
89+
echo "Running buf generate..."
90+
cd "$ROOT_DIR"
91+
buf generate
92+
uv run "$ROOT_DIR/scripts/grpc_gen_post_processor.py"
93+
94+
95+
echo "Committing generated types file to the \"$FEATURE_BRANCH\" branch..."
96+
git checkout -b "$FEATURE_BRANCH"
97+
git add "$GENERATED_FILE" "$ROOT_DIR/src/a2a/grpc"
98+
git commit -m "Experimental types"

scripts/generate_types.sh

Lines changed: 98 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,111 @@
44
# Treat unset variables as an error.
55
set -euo pipefail
66

7-
# Check if an output file path was provided as an argument.
8-
if [ -z "$1" ]; then
9-
echo "Error: Output file path must be provided as the first argument." >&2
7+
# A2A specification version to use
8+
# Can be overridden via environment variable: A2A_SPEC_VERSION=v1.2.0 ./generate_types.sh
9+
# Or via command-line flag: ./generate_types.sh --version v1.2.0 output.py
10+
# Use a specific git tag, branch name, or commit SHA
11+
# Examples: "v1.0.0", "v1.2.0", "main", "abc123def"
12+
A2A_SPEC_VERSION="${A2A_SPEC_VERSION:-v0.3.0}"
13+
14+
# Build URL based on version format
15+
# Tags use /refs/tags/, branches use /refs/heads/, commits use direct ref
16+
build_remote_url() {
17+
local version="$1"
18+
local base_url="https://raw.githubusercontent.com/a2aproject/A2A"
19+
local spec_path="specification/json/a2a.json"
20+
local url_part
21+
22+
if [[ "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
23+
# Looks like a version tag (v1.0.0, v1.2.3)
24+
url_part="refs/tags/${version}"
25+
elif [[ "$version" =~ ^[0-9a-f]{7,40}$ ]]; then
26+
# Looks like a commit SHA (7+ hex chars)
27+
url_part="${version}"
28+
else
29+
# Assume it's a branch name (main, develop, etc.)
30+
url_part="refs/heads/${version}"
31+
fi
32+
echo "${base_url}/${url_part}/${spec_path}"
33+
}
34+
35+
REMOTE_URL=$(build_remote_url "$A2A_SPEC_VERSION")
36+
37+
GENERATED_FILE=""
38+
INPUT_FILE=""
39+
40+
# Parse command-line arguments
41+
while [[ $# -gt 0 ]]; do
42+
case "$1" in
43+
--input-file)
44+
INPUT_FILE="$2"
45+
shift 2
46+
;;
47+
--version)
48+
A2A_SPEC_VERSION="$2"
49+
REMOTE_URL=$(build_remote_url "$A2A_SPEC_VERSION")
50+
shift 2
51+
;;
52+
*)
53+
GENERATED_FILE="$1"
54+
shift 1
55+
;;
56+
esac
57+
done
58+
59+
if [ -z "$GENERATED_FILE" ]; then
60+
cat >&2 <<EOF
61+
Error: Output file path must be provided.
62+
Usage: $0 [--input-file <path>] [--version <version>] <output-file-path>
63+
Options:
64+
--input-file <path> Use a local JSON schema file instead of fetching from remote
65+
--version <version> Specify A2A spec version (default: v0.3.0)
66+
Can be a git tag (v1.0.0), branch (main), or commit SHA
67+
Environment variables:
68+
A2A_SPEC_VERSION Override default spec version
69+
Examples:
70+
$0 src/a2a/types.py
71+
$0 --version v1.2.0 src/a2a/types.py
72+
$0 --input-file local/a2a.json src/a2a/types.py
73+
A2A_SPEC_VERSION=main $0 src/a2a/types.py
74+
EOF
1075
exit 1
1176
fi
1277

13-
REMOTE_URL="https://raw.githubusercontent.com/a2aproject/A2A/refs/heads/main/specification/json/a2a.json"
14-
GENERATED_FILE="$1"
15-
1678
echo "Running datamodel-codegen..."
17-
echo " - Source URL: $REMOTE_URL"
79+
declare -a source_args
80+
if [ -n "$INPUT_FILE" ]; then
81+
echo " - Source File: $INPUT_FILE"
82+
if [ ! -f "$INPUT_FILE" ]; then
83+
echo "Error: Input file does not exist: $INPUT_FILE" >&2
84+
exit 1
85+
fi
86+
source_args=("--input" "$INPUT_FILE")
87+
else
88+
echo " - A2A Spec Version: $A2A_SPEC_VERSION"
89+
echo " - Source URL: $REMOTE_URL"
90+
91+
# Validate that the remote URL is accessible
92+
echo " - Validating remote URL..."
93+
if ! curl --fail --silent --head "$REMOTE_URL" >/dev/null 2>&1; then
94+
cat >&2 <<EOF
95+
96+
Error: Unable to access A2A specification at version '$A2A_SPEC_VERSION'
97+
URL: $REMOTE_URL
98+
99+
The version may not exist. Available versions can be found at:
100+
https://github.com/a2aproject/A2A/tags
101+
102+
EOF
103+
exit 1
104+
fi
105+
106+
source_args=("--url" "$REMOTE_URL")
107+
fi
18108
echo " - Output File: $GENERATED_FILE"
19109

20110
uv run datamodel-codegen \
21-
--url "$REMOTE_URL" \
111+
"${source_args[@]}" \
22112
--input-file-type jsonschema \
23113
--output "$GENERATED_FILE" \
24114
--target-python-version 3.10 \

src/a2a/client/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
CredentialService,
88
InMemoryContextCredentialStore,
99
)
10+
from a2a.client.base_client import BaseClient
1011
from a2a.client.card_resolver import A2ACardResolver
1112
from a2a.client.client import Client, ClientConfig, ClientEvent, Consumer
1213
from a2a.client.client_factory import ClientFactory, minimal_agent_card
@@ -51,6 +52,7 @@ def __init__(self, *args, **kwargs):
5152
'A2AClientTimeoutError',
5253
'A2AGrpcClient',
5354
'AuthInterceptor',
55+
'BaseClient',
5456
'Client',
5557
'ClientCallContext',
5658
'ClientCallInterceptor',

0 commit comments

Comments
 (0)