Skip to content

Commit 10a7b72

Browse files
authored
Merge branch 'main' into jscpd-fixes
2 parents 7765856 + 8d636ea commit 10a7b72

26 files changed

+974
-36
lines changed

.git-blame-ignore-revs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Template taken from https://github.com/v8/v8/blob/master/.git-blame-ignore-revs.
2+
#
3+
# This file contains a list of git hashes of revisions to be ignored by git blame. These
4+
# revisions are considered "unimportant" in that they are unlikely to be what you are
5+
# interested in when blaming. Most of these will probably be commits related to linting
6+
# and code formatting.
7+
#
8+
# Instructions:
9+
# - Only large (generally automated) reformatting or renaming CLs should be
10+
# added to this list. Do not put things here just because you feel they are
11+
# trivial or unimportant. If in doubt, do not put it on this list.
12+
# - Precede each revision with a comment containing the PR title and number.
13+
# For bulk work over many commits, place all commits in a block with a single
14+
# comment at the top describing the work done in those commits.
15+
# - Only put full 40-character hashes on this list (not short hashes or any
16+
# other revision reference).
17+
# - Append to the bottom of the file (revisions should be in chronological order
18+
# from oldest to newest).
19+
# - Because you must use a hash, you need to append to this list in a follow-up
20+
# PR to the actual reformatting PR that you are trying to ignore.
21+
193693836e1ed8cd361e139668323d2e267a9eaa

.github/workflows/linter.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ name: Lint Code Base
1313
#############################
1414
# Start the job on all push #
1515
#############################
16-
on:
17-
pull_request:
18-
branches: [main]
16+
# on:
17+
# pull_request:
18+
# branches: [main]
19+
on: workflow_dispatch
1920

2021
###############
2122
# Set the Job #
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish Python Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
release-build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v5
19+
20+
- name: "Set up Python"
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version-file: "pyproject.toml"
24+
25+
- name: Build
26+
run: uv build
27+
28+
- name: Upload distributions
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: release-dists
32+
path: dist/
33+
34+
pypi-publish:
35+
runs-on: ubuntu-latest
36+
needs:
37+
- release-build
38+
permissions:
39+
id-token: write
40+
41+
steps:
42+
- name: Retrieve release distributions
43+
uses: actions/download-artifact@v4
44+
with:
45+
name: release-dists
46+
path: dist/
47+
48+
- name: Publish release distributions to PyPI
49+
uses: pypa/gh-action-pypi-publish@release/v1
50+
with:
51+
packages-dir: dist/
52+
53+
54+

examples/langgraph/__main__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
import sys
33

44
import click
5+
import httpx
56

67
from agent import CurrencyAgent
78
from agent_executor import CurrencyAgentExecutor
89
from dotenv import load_dotenv
910

1011
from a2a.server.apps import A2AStarletteApplication
1112
from a2a.server.request_handlers import DefaultRequestHandler
12-
from a2a.server.tasks import InMemoryTaskStore
13+
from a2a.server.tasks import InMemoryPushNotifier, InMemoryTaskStore
1314
from a2a.types import (
1415
AgentAuthentication,
1516
AgentCapabilities,
@@ -29,9 +30,11 @@ def main(host: str, port: int):
2930
print('GOOGLE_API_KEY environment variable not set.')
3031
sys.exit(1)
3132

33+
client = httpx.AsyncClient()
3234
request_handler = DefaultRequestHandler(
3335
agent_executor=CurrencyAgentExecutor(),
3436
task_store=InMemoryTaskStore(),
37+
push_notifier=InMemoryPushNotifier(client),
3538
)
3639

3740
server = A2AStarletteApplication(

pyproject.toml

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
[project]
22
name = "a2a-sdk"
3-
version = "0.2.0"
3+
dynamic = ["version"]
44
description = "A2A Python SDK"
55
readme = "README.md"
6+
license = { file = "LICENSE" }
7+
authors = [{ name = "Google LLC", email = "[email protected]" }]
68
requires-python = ">=3.13"
9+
keywords = ["A2A", "A2A SDK", "A2A Protocol", "Agent2Agent"]
710
dependencies = [
811
"httpx>=0.28.1",
912
"httpx-sse>=0.4.0",
@@ -15,6 +18,22 @@ dependencies = [
1518
"typing-extensions>=4.13.2",
1619
]
1720

21+
classifiers = [
22+
"Intended Audience :: Developers",
23+
"Programming Language :: Python",
24+
"Programming Language :: Python :: 3",
25+
"Programming Language :: Python :: 3.13",
26+
"Operating System :: OS Independent",
27+
"Topic :: Software Development :: Libraries :: Python Modules",
28+
"License :: OSI Approved :: Apache Software License",
29+
]
30+
31+
[project.urls]
32+
homepage = "https://google.github.io/A2A/"
33+
repository = "https://github.com/google/a2a-python"
34+
changelog = "https://github.com/google/a2a-python/blob/main/CHANGELOG.md"
35+
documentation = "https://google.github.io/A2A/"
36+
1837
[tool.hatch.build.targets.wheel]
1938
packages = ["src/a2a"]
2039

@@ -25,9 +44,21 @@ python_functions = "test_*"
2544
addopts = "--cov=src --cov-config=.coveragerc --cov-report term --cov-report xml:coverage.xml --cov-branch"
2645

2746
[build-system]
28-
requires = ["hatchling"]
47+
requires = ["hatchling", "uv-dynamic-versioning"]
2948
build-backend = "hatchling.build"
3049

50+
[tool.hatch.version]
51+
source = "uv-dynamic-versioning"
52+
53+
[tool.hatch.build.targets.sdist]
54+
exclude = [
55+
"tests/",
56+
]
57+
58+
[tool.uv-dynamic-versioning]
59+
vcs = "git"
60+
style = "pep440"
61+
3162
[tool.uv.workspace]
3263
members = [
3364
"examples/langgraph",
@@ -45,4 +76,11 @@ dev = [
4576
"pytest-cov>=6.1.1",
4677
"pytest-mock>=3.14.0",
4778
"ruff>=0.11.6",
79+
"uv-dynamic-versioning>=0.8.2",
4880
]
81+
82+
[[tool.uv.index]]
83+
name = "testpypi"
84+
url = "https://test.pypi.org/simple/"
85+
publish-url = "https://test.pypi.org/legacy/"
86+
explicit = true

src/a2a/client/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
SetTaskPushNotificationConfigRequest,
2525
SetTaskPushNotificationConfigResponse,
2626
)
27+
from a2a.utils.telemetry import SpanKind, trace_class
2728

2829

2930
async def _make_httpx_request(
@@ -81,6 +82,7 @@ async def get_agent_card(
8182
return AgentCard.model_validate(response_json)
8283

8384

85+
@trace_class(kind=SpanKind.CLIENT)
8486
class A2AClient:
8587
"""A2A Client."""
8688

src/a2a/server/agent_execution/context.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
InvalidParamsError,
55
Message,
66
MessageSendParams,
7+
MessageSendConfiguration,
78
Task,
89
)
910
from a2a.utils import get_message_text
@@ -79,6 +80,10 @@ def task_id(self) -> str | None:
7980
def context_id(self) -> str | None:
8081
return self._context_id
8182

83+
@property
84+
def configuration(self) -> MessageSendConfiguration | None:
85+
return self._params.configuration
86+
8287
def _check_or_generate_task_id(self) -> None:
8388
if not self._params:
8489
return

src/a2a/server/events/event_consumer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
TaskStatusUpdateEvent,
1313
)
1414
from a2a.utils.errors import ServerError
15+
from a2a.utils.telemetry import SpanKind, trace_class
1516

1617

1718
logger = logging.getLogger(__name__)
1819

1920

21+
@trace_class(kind=SpanKind.SERVER)
2022
class EventConsumer:
2123
"""Consumer to read events from the agent event queue."""
2224

src/a2a/server/events/event_queue.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
TaskArtifactUpdateEvent,
1212
TaskStatusUpdateEvent,
1313
)
14+
from a2a.utils.telemetry import SpanKind, trace_class
1415

1516

1617
logger = logging.getLogger(__name__)
@@ -26,6 +27,7 @@
2627
)
2728

2829

30+
@trace_class(kind=SpanKind.SERVER)
2931
class EventQueue:
3032
"""Event queue for A2A responses from agent."""
3133

src/a2a/server/events/in_memory_queue_manager.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
QueueManager,
77
TaskQueueExists,
88
)
9+
from a2a.utils.telemetry import SpanKind, trace_class
910

1011

12+
@trace_class(kind=SpanKind.SERVER)
1113
class InMemoryQueueManager(QueueManager):
1214
"""InMemoryQueueManager is used for a single binary management.
1315

0 commit comments

Comments
 (0)