Skip to main content

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:

  • SendMessage
  • SendStreamingMessage
  • GetTask
  • CancelTask

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

spakky_a2a-6.10.0.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spakky_a2a-6.10.0-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

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

Hashes for spakky_a2a-6.10.0.tar.gz
Algorithm Hash digest
SHA256 eee4acac52b462681d8445c8ff8cb09d7b224b3998f4c91568d5371911350f99
MD5 2f81d1e2603f0490cb86bbe37c9c404f
BLAKE2b-256 61843ee1ce6330a4f69aabed87ed874fe4f12735f6a7a695e9b15d9e25ed0cbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for spakky_a2a-6.10.0.tar.gz:

Publisher: publish-package.yml on E5presso/spakky-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for spakky_a2a-6.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af5ace93a317f8e9c1af606a5d93e36ff3e0565e05770f5631fda18d7dc73fdc
MD5 fdc5cfcafb4326bfc782dda0c8ebc7a2
BLAKE2b-256 071e1bd455d2a0130496ba83949bf7e99587a233c15f93c917a05dedc6f135b9

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page