Skip to content

[Enhancement]: Add opt-in async unary A2A client operations #269

Open

Description

@MisterVVP

Problem

The public A2AClient and ClientTransport unary methods are synchronous. HTTP streaming already uses a shared libcurl multi/reactor internally, but ordinary unary calls do not provide an application-facing async operation. The gRPC client also uses synchronous unary calls.

Goal

Add a coherent, opt-in async unary client API for all supported transports without replacing synchronous methods or creating one thread per in-flight request.

Ownership and issue boundaries (v0.6.0)

Owns: Outbound opt-in async A2A unary API, reusable HTTP request machinery in the existing libcurl multi/reactor, and native gRPC async unary client.

Prerequisites and integration: #232 improves Windows readiness on the same outbound reactor; coordinate before Windows-specific adoption, but #269 PR 1 and Linux work can proceed independently. #267 can start after #269 PR 2; it must not wait for gRPC client PR 3. Coordinate completion conventions with #268.

Must not absorb: No new independent reactor, per-request worker, inbound sockets (#270), push delivery policy (#267) or new server executor (#268). Preserve sync client and StreamObserver APIs.

Issue management: Keep this single issue. The maintainer requested that all five implementation checkpoints be delivered together in #325, targeting release/v0.6.0. The planned PR numbers below identify checkpoints completed within that one PR. Leave the issue open at the maintainer's request.

Implementation PR checklist

  • PR 1 — One client completion/cancellation/timeout/shutdown contract and fake-transport tests for all unary operations and Agent Card discovery.
  • PR 2 — Shared libcurl async request primitive plus HTTP+JSON unary implementation, with reactor ownership, bounds and lifecycle tests.
  • PR 3 — JSON-RPC unary integration using the same primitive and protocol-specific validation/error mapping; mixed unary/streaming tests. This checkpoint makes the shared HTTP engine ready for [Enhancement]: Add asynchronous push-notification HTTP delivery #267.
  • PR 4 — Native gRPC client callback/async unary for every supported method, deadlines/metadata/interceptors and races.
  • PR 5 — Cross-platform installed-consumer checks, benchmark comparisons, docs, full TCK run with the maintainer-approved baseline exception, and performance gates.

PR merge rule: Each PR must have a narrow diff, behavior/lifecycle tests for its scope, and the applicable repository checks from AGENTS.md. Benchmark performance-sensitive changes against equivalent baseline configurations. Never describe blocking worker adaptation as non-blocking network/database I/O.

Detailed technical requirements and implementation phases

Phase 1 — Public contract and lifecycle

  • Choose one primary async completion model (callback, SDK task/future or coroutine-friendly abstraction) and document its lifetime, ownership, errors, cancellation, deadline and completion guarantees. Avoid shipping multiple unrelated async styles at once.
  • Cover SendMessage, GetTask, ListTasks, CancelTask, push-configuration operations and an explicit asynchronous agent-card discovery path (or a clearly documented limit with a reviewed follow-up).
  • Preserve current return/result semantics, authentication/extensions/metadata, CallOptions::timeout, and existing synchronous A2AClient/ClientTransport methods.
  • Define BeforeCall/AfterCall ordering and once-only completion under cancel/timeout/shutdown races. Application callbacks must run away from network reactor threads.
  • Test the API against a fake transport before introducing network changes.

Checkpoint: Public types and lifecycle rules can be reviewed without touching all three network implementations.

Phase 2 — HTTP+JSON and JSON-RPC implementation

  • Reuse or extend the shared libcurl multi/reactor already used by HTTP streaming; do not create a second independent reactor for async unary requests.
  • Preserve HTTP connection reuse, response decoding, version/extension headers, authentication, validation, and protocol error mapping for both wire formats.
  • Handle rapid cancel, deadlines, connection failures and client shutdown; no one-easy-handle worker thread or std::async wrapper per operation.
  • Ensure reactor ownership and callback isolation remain deterministic. Test multiple simultaneous unary operations using the same client and mixed unary/streaming workloads.

Checkpoint: HTTP+JSON and JSON-RPC async unary calls function without changing synchronous behavior.

Phase 3 — gRPC implementation and whole-client validation

  • Use native gRPC async/callback unary APIs, not blocking stubs dispatched to an SDK thread per call.
  • Preserve metadata/auth/extensions, deadlines, error mapping, and observable interceptor semantics.
  • Validate each unary method, timeout/cancellation, completion races, destruction/shutdown, and concurrency across all three transports.
  • Compare synchronous and async thread use, throughput and latency at representative concurrency; document idiomatic usage.

Relationship to other issues

  • #267 should reuse the HTTP async request machinery introduced here for outbound webhook delivery. It need not wait for the gRPC-specific phase if the HTTP mechanism is stable.
  • #232 improves the Windows readiness implementation of the shared libcurl client reactor, independently of this public API.
  • #268 implements server-side async execution, not outbound requests.

Out of scope

  • Removing or rewriting synchronous client APIs or replacing the current streaming observer API.
  • Creating a new network stack or one worker thread per request to simulate async I/O.
  • Implementing push-delivery policies, server executors, or async database stores.

Acceptance criteria

  • One documented, opt-in asynchronous client model covers all supported unary operations.
  • Existing sync client methods remain source-compatible and retain their tested semantics.
  • HTTP+JSON/JSON-RPC reuse shared libcurl multi infrastructure; gRPC uses native async/callback calls.
  • No per-in-flight-request SDK worker thread; network reactors never execute user callbacks.
  • Cancellation, timeouts, interceptors, result/error mapping, completion races and shutdown are deterministic and covered by tests.
  • Supported-platform tests and required performance smoke remain green; mandatory TCK matches the maintainer-approved baseline exception documented below.
  • Benchmarks describe actual async concurrency, resource use, and any sync-path performance regression.

Implementation and validation evidence

All five checkpoints were delivered together in #325, merged into release/v0.6.0 as 6954748, as requested by the maintainer. The tested PR head is 4fa213f41dbe8d566befdbe3b5e4155efc982806.

  • Contract: one callback model covers all eight unary methods plus both Agent Card discovery paths, with cancellation, deadlines, interceptor snapshots and draining/reentrant shutdown. See the guide and fake-transport/lifecycle regressions.
  • HTTP+JSON and JSON-RPC compose the shared native HTTP async primitive on the existing libcurl reactor, including bounds, connection reuse, mixed streaming workloads and protocol-specific validation. Real-network tests cover concurrency and reuse.
  • gRPC uses native callback unary calls, with metadata/deadlines, native-call lifetime management and integration/race tests. Existing synchronous APIs and streaming observers are preserved.
  • Validation: local verify_changes.sh and the separate required clang-tidy command exit 0; 864 tests report zero failures (four conditional/inapplicable skips), and the focused ASan/UBSan profile reports 80 tests with zero failures (one inapplicable binding skip). Documentation, the libcurl-disabled smoke and dependency scan pass. Required gRPC/HTTP performance smoke reports 54 rows with zero errors.
  • CI for the final commit has passed Linux/macOS/Windows tests, installed-consumer checks, ASan/UBSan, ThreadSanitizer, coverage, interoperability, benchmarks and both performance suites. All fifteen CI jobs, including the full source clang-tidy scan and final diagnostics checks, passed. CodeQL, docs, tutorials and commit-message checks pass.
  • The guide records real network concurrency, latency/throughput and sampled resource use, together with equivalent synchronous baseline comparisons and workload limits. All six existing parsing thresholds pass; selected synchronous baseline/candidate changes range from -4.5% to +3.3%.

TCK baseline exception: The final CI run uses unmodified upstream 104a7b4ae0d83f65c075e3793e322953a830eaba. Both stores report 242 passed, 17 skipped and four known baseline failures: missing expected_error for CORE-SEND-003 on all three bindings, plus contradictory HTTP AIP-193/media-type assertions. The coroutine run reports the same CORE-SEND-003 defect (82 passed, 180 skipped, one failure). Mandatory requirement coverage remains 82.7%; requirements without upstream fixtures remain NOT TESTED. The maintainer explicitly approved the exception for these documented baseline defects and coverage gaps. No assertions, skip rules or script exit statuses were changed; this is not a claim of 100% TCK compliance.

The issue remains open at the maintainer's request.

Activity

  1. added this to the v0.6.0 milestone on Oct 5, 2026
  2. added
    enhancement
    on Oct 5, 2026
  3. changed the title [-][Enhancement]: Add opt-in asynchronous unary client APIs across HTTP+JSON, JSON-RPC, and gRPC[/-] [+][Enhancement]: Add opt-in async unary A2A client operations[/+] on Oct 11, 2026
  4. moved this from Todo to In Progress in a2a-cpp SDK Roadmapon Nov 7, 2026
  5. self-assigned this
    on Nov 7, 2026
  6. linked a pull request that will close this issueRelease v0.6.0 #322on Nov 7, 2026
  7. moved this from In Progress to In Review in a2a-cpp SDK Roadmapon Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions