Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
@@ -1,53 +1,29 @@
a2a
A2A
A2AFastAPI
AAgent
ACMRTUXB
ACard
AClient
ACMRTUXB
aconnect
adk
AError
AException
AFast
agentic
AGrpc
aio
aiomysql
alg
amannn
aproject
ARequest
ARun
AServer
AServers
AService
AStarlette
AUser
DSNs
ES256
EUR
FastAPI
GBP
GVsb
HS256
HS384
INR
JOSE
JPY
JSONRPC
JSONRPCt
JWS
Llm
OpenAPI
POSTGRES
Protobuf
RS256
RUF
SECP256R1
SLF
Starlette
Tful
a2a
aconnect
adk
agentic
aio
aiomysql
alg
amannn
aproject
autouse
backticks
base64url
Expand All @@ -60,46 +36,64 @@ coro
datamodel
deepwiki
drivername
DSNs
dunders
ES256
euo
EUR
excinfo
FastAPI
fernet
fetchrow
fetchval
GBP
genai
getkwargs
gle
GVsb
hazmat
HS256
HS384
ietf
importlib
initdb
inmemory
INR
isready
jku
JOSE
JPY
JSONRPC
JSONRPCt
jwk
jwks
jws
JWS
kid
kwarg
langgraph
lifecycles
linting
Llm
lstrips
middleware
mikeas
mockurl
notif
oauthoidc
oidc
OpenAPI
openapiv
openapiv2
opensource
otherurl
pb2
postgres
POSTGRES
postgresql
proto
protobuf
Protobuf
protoc
pydantic
pyi
Expand All @@ -109,13 +103,19 @@ pyversions
redef
respx
resub
RS256
RUF
SECP256R1
SLF
socio
sse
starlette
Starlette
swagger
tagwords
taskupdate
testuuid
Tful
tiangolo
typ
typeerror
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Lint Code Base
on:
pull_request:
branches: [main]
branches: [main, 1.0-a2a_proto_refactor]
permissions:
contents: read
jobs:
Expand All @@ -22,6 +22,8 @@ jobs:
- name: Add uv to PATH
run: |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install Buf
uses: bufbuild/buf-setup-action@v1
- name: Install dependencies
run: uv sync --dev

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Run Unit Tests
on:
pull_request:
branches: [main]
branches: [main, 1.0-a2a_proto_refactor]
permissions:
contents: read
jobs:
Expand Down Expand Up @@ -36,7 +36,7 @@ jobs:

strategy:
matrix:
python-version: ['3.10', '3.13']
python-version: ["3.10", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v6
Expand All @@ -52,6 +52,8 @@ jobs:
- name: Add uv to PATH
run: |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install Buf
uses: bufbuild/buf-setup-action@v1
- name: Install dependencies
run: uv sync --dev --extra all
- name: Run tests and check coverage
Expand Down
2 changes: 1 addition & 1 deletion buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: v2
inputs:
- git_repo: https://github.com/a2aproject/A2A.git
ref: main
subdir: specification/grpc
subdir: specification
managed:
enabled: true
# Python Generation
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,10 @@ exclude = [
"**/node_modules",
"**/venv",
"**/.venv",
"src/a2a/types/a2a_pb2.py",
"src/a2a/types/a2a_pb2_grpc.py",
"src/a2a/types",
]
reportMissingImports = "none"
reportMissingModuleSource = "none"
venvPath = "."
venv = ".venv"

[tool.coverage.run]
branch = true
Expand Down
13 changes: 13 additions & 0 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"venvPath": ".",
"venv": ".venv",
"include": [
"src"
],
"exclude": [
"**/__pycache__",
"src/a2a/types"
],
"reportMissingImports": false,
"reportMissingModuleSource": false
}
2 changes: 1 addition & 1 deletion scripts/gen_proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ fi

# Fix imports in generated grpc file
echo "Fixing imports in src/a2a/types/a2a_pb2_grpc.py"
sed -i '' 's/import a2a_pb2 as a2a__pb2/from . import a2a_pb2 as a2a__pb2/g' src/a2a/types/a2a_pb2_grpc.py
sed 's/import a2a_pb2 as a2a__pb2/from . import a2a_pb2 as a2a__pb2/g' src/a2a/types/a2a_pb2_grpc.py > src/a2a/types/a2a_pb2_grpc.py.tmp && mv src/a2a/types/a2a_pb2_grpc.py.tmp src/a2a/types/a2a_pb2_grpc.py
4 changes: 2 additions & 2 deletions src/a2a/client/auth/interceptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ async def intercept(
# We check for truthiness to see if they are non-empty.
if (
agent_card is None
or not agent_card.security
or not agent_card.security_requirements
or not agent_card.security_schemes
):
return request_payload, http_kwargs

for requirement in agent_card.security:
for requirement in agent_card.security_requirements:
for scheme_name in requirement.schemes:
credential = await self._credential_service.get_credentials(
scheme_name, context
Expand Down
4 changes: 2 additions & 2 deletions src/a2a/client/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
from a2a.types.a2a_pb2 import (
AgentCard,
CancelTaskRequest,
CreateTaskPushNotificationConfigRequest,
GetTaskPushNotificationConfigRequest,
GetTaskRequest,
Message,
SendMessageConfiguration,
SendMessageRequest,
SetTaskPushNotificationConfigRequest,
StreamResponse,
SubscribeToTaskRequest,
Task,
Expand Down Expand Up @@ -180,7 +180,7 @@ async def cancel_task(

async def set_task_callback(
self,
request: SetTaskPushNotificationConfigRequest,
request: CreateTaskPushNotificationConfigRequest,
*,
context: ClientCallContext | None = None,
extensions: list[str] | None = None,
Expand Down
4 changes: 2 additions & 2 deletions src/a2a/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
from a2a.types.a2a_pb2 import (
AgentCard,
CancelTaskRequest,
CreateTaskPushNotificationConfigRequest,
GetTaskPushNotificationConfigRequest,
GetTaskRequest,
Message,
PushNotificationConfig,
SetTaskPushNotificationConfigRequest,
StreamResponse,
SubscribeToTaskRequest,
Task,
Expand Down Expand Up @@ -147,7 +147,7 @@ async def cancel_task(
@abstractmethod
async def set_task_callback(
self,
request: SetTaskPushNotificationConfigRequest,
request: CreateTaskPushNotificationConfigRequest,
*,
context: ClientCallContext | None = None,
extensions: list[str] | None = None,
Expand Down
1 change: 0 additions & 1 deletion src/a2a/client/client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,5 +282,4 @@ def minimal_agent_card(
skills=[],
version='',
name='',
protocol_versions=['v1'],
)
4 changes: 2 additions & 2 deletions src/a2a/client/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from a2a.types.a2a_pb2 import (
AgentCard,
CancelTaskRequest,
CreateTaskPushNotificationConfigRequest,
GetTaskPushNotificationConfigRequest,
GetTaskRequest,
SendMessageRequest,
SendMessageResponse,
SetTaskPushNotificationConfigRequest,
StreamResponse,
SubscribeToTaskRequest,
Task,
Expand Down Expand Up @@ -65,7 +65,7 @@ async def cancel_task(
@abstractmethod
async def set_task_callback(
self,
request: SetTaskPushNotificationConfigRequest,
request: CreateTaskPushNotificationConfigRequest,
*,
context: ClientCallContext | None = None,
extensions: list[str] | None = None,
Expand Down
6 changes: 3 additions & 3 deletions src/a2a/client/transports/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
from a2a.types.a2a_pb2 import (
AgentCard,
CancelTaskRequest,
CreateTaskPushNotificationConfigRequest,
GetTaskPushNotificationConfigRequest,
GetTaskRequest,
SendMessageRequest,
SendMessageResponse,
SetTaskPushNotificationConfigRequest,
StreamResponse,
SubscribeToTaskRequest,
Task,
Expand Down Expand Up @@ -158,13 +158,13 @@ async def cancel_task(

async def set_task_callback(
self,
request: SetTaskPushNotificationConfigRequest,
request: CreateTaskPushNotificationConfigRequest,
*,
context: ClientCallContext | None = None,
extensions: list[str] | None = None,
) -> TaskPushNotificationConfig:
"""Sets or updates the push notification configuration for a specific task."""
return await self.stub.SetTaskPushNotificationConfig(
return await self.stub.CreateTaskPushNotificationConfig(
request,
metadata=self._get_grpc_metadata(extensions),
)
Expand Down
8 changes: 4 additions & 4 deletions src/a2a/client/transports/jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
from a2a.types.a2a_pb2 import (
AgentCard,
CancelTaskRequest,
CreateTaskPushNotificationConfigRequest,
GetExtendedAgentCardRequest,
GetTaskPushNotificationConfigRequest,
GetTaskRequest,
SendMessageRequest,
SendMessageResponse,
SetTaskPushNotificationConfigRequest,
StreamResponse,
SubscribeToTaskRequest,
Task,
Expand Down Expand Up @@ -264,51 +264,51 @@
extensions if extensions is not None else self.extensions,
)
payload, modified_kwargs = await self._apply_interceptors(
'CancelTask',
cast('dict[str, Any]', rpc_request.data),
modified_kwargs,
context,
)
response_data = await self._send_request(payload, modified_kwargs)
json_rpc_response = JSONRPC20Response(**response_data)
if json_rpc_response.error:
raise A2AClientJSONRPCError(json_rpc_response.error)
response: Task = json_format.ParseDict(json_rpc_response.result, Task())
return response

async def set_task_callback(

Check notice on line 279 in src/a2a/client/transports/jsonrpc.py

View workflow job for this annotation

GitHub Actions / Lint Code Base

Copy/pasted code

see src/a2a/client/transports/jsonrpc.py (237-249)
self,
request: SetTaskPushNotificationConfigRequest,
request: CreateTaskPushNotificationConfigRequest,
*,
context: ClientCallContext | None = None,
extensions: list[str] | None = None,
) -> TaskPushNotificationConfig:
"""Sets or updates the push notification configuration for a specific task."""
rpc_request = JSONRPC20Request(
method='SetTaskPushNotificationConfig',
method='CreateTaskPushNotificationConfig',
params=json_format.MessageToDict(request),
_id=str(uuid4()),
)
modified_kwargs = update_extension_header(
self._get_http_args(context),
extensions if extensions is not None else self.extensions,
)
payload, modified_kwargs = await self._apply_interceptors(
'SetTaskPushNotificationConfig',
'CreateTaskPushNotificationConfig',

Check notice on line 297 in src/a2a/client/transports/jsonrpc.py

View workflow job for this annotation

GitHub Actions / Lint Code Base

Copy/pasted code

see src/a2a/client/transports/jsonrpc.py (114-123)
cast('dict[str, Any]', rpc_request.data),
modified_kwargs,
context,
)
response_data = await self._send_request(payload, modified_kwargs)
json_rpc_response = JSONRPC20Response(**response_data)
if json_rpc_response.error:
raise A2AClientJSONRPCError(json_rpc_response.error)
response: TaskPushNotificationConfig = json_format.ParseDict(
json_rpc_response.result, TaskPushNotificationConfig()
)
return response

async def get_task_callback(

Check notice on line 311 in src/a2a/client/transports/jsonrpc.py

View workflow job for this annotation

GitHub Actions / Lint Code Base

Copy/pasted code

see src/a2a/client/transports/jsonrpc.py (329-343)
self,
request: GetTaskPushNotificationConfigRequest,
*,
Expand Down
Loading
Loading