Repository navigation
Description
Context
We (A2A Go, Python and JS SDK maintainers) have recently introduced a plugin framework across all 3 SDKs to give users a unified way to build cross-cutting features (such as OpenTelemetry tracing/metrics, authentication, auditing, retries, caching, and header/context propagation).
Sharing this here in case it makes sense to adopt a similar model in this SDK.
Motivation
Cross-cutting integrations often need to hook into several parts of the SDK at once, not just RPC calls:
- Incoming server calls (unary and streaming)
- Outgoing client calls (unary and streaming)
- Agent execution (before/after execution, around execution for context scoping, emitted events)
- Task store writes (observing task creation and state transitions)
- Push notification deliveries (injecting headers, skipping deliveries, observing status/duration/errors)
Simple before/after call interceptors alone are not enough for cases like retries, caching, timeouts, or ending a tracing span when a stream finishes—so having a way to wrap calls/components alongside (or backing) lifecycle hooks has been key.
Key Ideas (Shared Across Go / Python / JS)
- Single registration point for a plugin that can hook into multiple SDK components.
- Selective hooks: plugins only implement the hooks they need; unused hooks have no overhead.
- Wrapping + lifecycle hooks: support both wrapping execution/calls (for spans, retries, short-circuiting, stream end detection) and simple
before/afterhooks. - Deterministic ordering:
beforehooks run in registration order;afterhooks run in reverse order. - Backwards-compatible: existing interceptors/extension points continue to work.
Reference Implementations
Go (a2a-go) — wrap-based core interfaces + hook-based helper layer:
- Design issue: Introduce plugin framework a2a-go#538
- Core plugin interface: feat: add plugin interface a2a-go#572
- Hook helpers (
a2aplugin): feat(a2aplugin): add hook-based plugin helpers a2a-go#581 - Examples built on it: OAuth client plugin (feat(a2aclient/oauth): sign in and attach OAuth tokens with a client plugin a2a-go#570), OpenTelemetry tracing plugin (feat: add OpenTelemetry plugin with traces a2a-go#616)
Python (a2a-python) — protocol/interface-based plugins + call wrapping:
- Core plugin framework: feat: add plugin framework a2a-python#1352
wrap_client_call/wrap_server_callhooks: feat: Add plugin wrap call hooks to Client and Server plugins a2a-python#1491- OpenTelemetry client plugin (WIP): feat: Add OpenTelemtry support for client via plugin a2a-python#1504
JS/TS (a2a-js) — hook-based plugin object wired across server, client, execution, task store, and push:
- Core types: feat: Add core types and methods for plugins support a2a-js#826
- Hook integrations: server (feat: Add server plugin hooks in DefaultRequestHandler a2a-js#835), client (feat: Add client plugin hooks in Client a2a-js#838), execution (feat: Add execution plugin hooks around AgentExecutor a2a-js#839), task store (feat: Add task plugin hooks for task store writes a2a-js#840), push (feat: Add push notification plugin hooks in DefaultPushNotificationSender a2a-js#841)
- Tests, samples, and docs: test: Add integration tests for A2A plugins a2a-js#846, chore(samples): Add samples for A2A plugins a2a-js#847, docs(plugins): Add documentation for A2A plugins a2a-js#848
Does a plugin framework like this fit the roadmap and architecture of this SDK?
Activity