A2A (Agent2Agent) protocol server plugin for Spakky framework
Project description
spakky-a2a
A2A (Agent2Agent) protocol server plugin for the Spakky framework.
Remote teammate delegation
A2AAgentDelegate implements the core IAgentDelegate port for teammates whose
AgentExecutionSpec.teammates entry points at a remote AgentCard URL. The core
agent runner exposes each teammate as a model-callable delegation tool named
teammate.<name>.delegate; local teammate pods run in-process, while remote
teammates use the official a2a-sdk client.
from spakky.agent import Agent, AgentExecutionSpec, AgentTeammate
from spakky.plugins.a2a import A2AAgentDelegate
@Agent(
spec=AgentExecutionSpec(
name="orchestrator",
teammates=(
AgentTeammate(
name="researcher",
card_url="https://agents.example.com/.well-known/agent-card.json",
),
),
)
)
class Orchestrator:
def __init__(self, delegate: A2AAgentDelegate) -> None:
self._delegate = delegate
Remote delegation sends message/send through the SDK client, tracks the remote
task stream, and maps child task/message/artifact updates back into Spakky's
protocol-neutral event stream with the parent run id preserved.
REST HTTP+JSON transport
build_a2a_rest_app() builds a mountable Starlette app for the official A2A
HTTP+JSON binding. The transport reuses the same AgentCard derivation,
TaskStore, SpakkyAgentExecutor, and neutral agent-event projection used by
the JSON-RPC and gRPC transports.
from spakky.plugins.a2a.rest_transport import build_a2a_rest_app
app = build_a2a_rest_app(
assistant_agent,
base_url="https://agents.example.com/a2a",
version="1.0.0",
)
The SDK route names differ from JSON-RPC method strings:
| A2A operation | REST route |
|---|---|
message/send |
POST /message:send |
message/stream |
POST /message:stream |
tasks/get |
GET /tasks/{id} |
tasks/cancel |
POST /tasks/{id}:cancel |
tasks/subscribe |
GET /tasks/{id}:subscribe or POST /tasks/{id}:subscribe |
REST request and response bodies use the A2A SDK protobuf JSON encoding. For
example, send a user message with {"message":{"role":"ROLE_USER","messageId":"m1","parts":[{"text":"hi"}]}}.
HITL and auth interrupts
SpakkyAgentExecutor consumes the core AgentRunner.run_events() stream. Approval
and auth pauses arrive as protocol-neutral RunPausedEvent items rather than as
successful RunFinishedEvent terminals. The A2A projector maps
reason=approval_required to TASK_STATE_INPUT_REQUIRED and includes the
approval id plus allowed decisions in a data part. It maps reason=auth_required
to TASK_STATE_AUTH_REQUIRED, so auth-required is reachable without inspecting
durable state.reason after the run stream drains.
gRPC transport
build_a2a_grpc_handler() builds a grpc.GenericRpcHandler for the official
lf.a2a.v1.A2AService descriptor. The transport exposes:
SendMessageSendStreamingMessageGetTaskCancelTask
The gRPC handler reuses the same AgentCard derivation, TaskStore,
SpakkyAgentExecutor, and neutral agent-event projection used by the JSON-RPC
transport. Add the handler to a spakky-grpc GrpcServerSpec or another
grpc.aio.Server, then call /lf.a2a.v1.A2AService/<Method> with the protobuf
message classes provided by a2a-sdk.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spakky_a2a-6.10.0.tar.gz.
File metadata
- Download URL: spakky_a2a-6.10.0.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eee4acac52b462681d8445c8ff8cb09d7b224b3998f4c91568d5371911350f99
|
|
| MD5 |
2f81d1e2603f0490cb86bbe37c9c404f
|
|
| BLAKE2b-256 |
61843ee1ce6330a4f69aabed87ed874fe4f12735f6a7a695e9b15d9e25ed0cbe
|
Provenance
The following attestation bundles were made for spakky_a2a-6.10.0.tar.gz:
Publisher:
publish-package.yml on E5presso/spakky-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spakky_a2a-6.10.0.tar.gz -
Subject digest:
eee4acac52b462681d8445c8ff8cb09d7b224b3998f4c91568d5371911350f99 - Sigstore transparency entry: 1959503423
- Sigstore integration time:
-
Permalink:
E5presso/spakky-framework@2d9c3ac4fad7d48f5be50fb29c5d0b933a283ebc -
Branch / Tag:
refs/heads/main - Owner: https://github.com/E5presso
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@2d9c3ac4fad7d48f5be50fb29c5d0b933a283ebc -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file spakky_a2a-6.10.0-py3-none-any.whl.
File metadata
- Download URL: spakky_a2a-6.10.0-py3-none-any.whl
- Upload date:
- Size: 31.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af5ace93a317f8e9c1af606a5d93e36ff3e0565e05770f5631fda18d7dc73fdc
|
|
| MD5 |
fdc5cfcafb4326bfc782dda0c8ebc7a2
|
|
| BLAKE2b-256 |
071e1bd455d2a0130496ba83949bf7e99587a233c15f93c917a05dedc6f135b9
|
Provenance
The following attestation bundles were made for spakky_a2a-6.10.0-py3-none-any.whl:
Publisher:
publish-package.yml on E5presso/spakky-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spakky_a2a-6.10.0-py3-none-any.whl -
Subject digest:
af5ace93a317f8e9c1af606a5d93e36ff3e0565e05770f5631fda18d7dc73fdc - Sigstore transparency entry: 1959503509
- Sigstore integration time:
-
Permalink:
E5presso/spakky-framework@2d9c3ac4fad7d48f5be50fb29c5d0b933a283ebc -
Branch / Tag:
refs/heads/main - Owner: https://github.com/E5presso
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@2d9c3ac4fad7d48f5be50fb29c5d0b933a283ebc -
Trigger Event:
workflow_dispatch
-
Statement type: