Skip to content

feat(server): expose SendMessageRequest metadata to AgentExecutor via RequestContext - #564

Merged
JakubWorek merged 2 commits into
a2aproject:epic/1.0_breaking_changesfrom
wyrd-company:feat/expose-send-message-request-metadata
Jul 7, 2026
Merged

feat(server): expose SendMessageRequest metadata to AgentExecutor via RequestContext#564
JakubWorek merged 2 commits into
a2aproject:epic/1.0_breaking_changesfrom
wyrd-company:feat/expose-send-message-request-metadata

Conversation

@boblangley

Copy link
Copy Markdown
Contributor

Adds an optional readonly metadata: Record<string, unknown> property to
RequestContext, populated from SendMessageRequest.metadata in both
sendMessage and sendMessageStream.

  • The property is appended as a trailing optional constructor parameter, so
    existing RequestContext construction sites are unaffected.
  • It is undefined when the request carries no metadata — no behavior change
    for existing executors.
  • Two tests added to default_request_handler.spec.ts: request metadata
    reaches the executor on both the unary and streaming send paths (exercised
    with the spec's own a2a-service-parameters pattern), and the property
    stays undefined when the request carries none.

Description

Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Follow the CONTRIBUTING Guide.
  • Make your Pull Request title in the https://www.conventionalcommits.org/ specification.
    • Important Prefixes for release-please:
      • fix: which represents bug fixes, and correlates to a SemVer patch.
      • feat: represents a new feature, and correlates to a SemVer minor.
      • feat!:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a SemVer major.
  • Ensure the tests and linter pass
  • Appropriate docs were updated (if necessary)

Fixes #563 🦕

… RequestContext

The A2A specification defines SendMessageRequest.metadata as 'a flexible
key-value map for passing additional context or parameters', and the
extension mechanism encourages carrying extension data in request metadata.
DefaultRequestHandler previously dropped this field before invoking the
AgentExecutor, leaving server-side agents no way to read it.

RequestContext gains an optional readonly metadata property, threaded from
params.metadata in both sendMessage and sendMessageStream. Existing
RequestContext call sites are unaffected (new trailing optional parameter).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@boblangley
boblangley requested a review from a team as a code owner July 3, 2026 17:54
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

🧪 Code Coverage

⬇️ Download Full Report

Base PR Delta
src/server/request_handler/default_request_handler.ts 87.72% 87.96% 🟢 +0.24%
Total 90.65% 90.67% 🟢 +0.02%

Generated by coverage-comment.yml

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a request-level metadata field to RequestContext to allow metadata from SendMessageRequest to be threaded through to the agent executor. The DefaultRequestHandler has been updated to extract and pass this metadata, and corresponding unit tests have been added to verify the behavior. The reviewer recommends deep copying the metadata object using structuredClone in the RequestContext constructor to prevent external mutations from affecting the internal state.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/server/agent_execution/request_context.ts
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

@JakubWorek JakubWorek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @boblangley, thank you for contribution into a2a

@JakubWorek
JakubWorek merged commit a92f54e into a2aproject:epic/1.0_breaking_changes Jul 7, 2026
12 checks passed
@boblangley
boblangley deleted the feat/expose-send-message-request-metadata branch July 8, 2026 05:26
JakubWorek added a commit that referenced this pull request Jul 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.0.0](v1.0.0-beta.0...v1.0.0)
(2026-07-22)

`@a2a-js/sdk` is now generally available. This release promotes the v1.0
line to stable, implementing the full [A2A Protocol Specification
v1.0](https://a2a-protocol.org/v1.0.0/specification/) across all three
transports (JSON-RPC, HTTP+JSON/REST, gRPC), with opt-in v0.3 backward
compatibility for staged migrations.

Upgrading from `0.3.x`? See the [v0.3 → v1.0 migration
guide](https://github.com/a2aproject/a2a-js/blob/v1.0.0/docs/migration-guide.md).
Interoperating with peers still on v0.3? See the [end-user v0.3
compatibility
guide](https://github.com/a2aproject/a2a-js/blob/v1.0.0/docs/compatibility-v0_3.md).


### ⚠ BREAKING CHANGES

* unify A2AError hierarchy with transport specific subclasses
([#587](#587))
* **server:** replace individual properties with SendMessageRequest in
RequestContext ([#581](#581))

### Features

* add state bag and ServerCallContextBuilder to ServerCallContext
([#364](#364))
([477e394](477e394))
* export SSE wire-format helpers from public entry point
([#548](#548))
([8bc21f5](8bc21f5)),
closes [#547](#547)
* **server:** expose SendMessageRequest metadata to AgentExecutor via
RequestContext ([#564](#564))
([a92f54e](a92f54e))
* **server:** replace individual properties with SendMessageRequest in
RequestContext ([#581](#581))
([7cd30de](7cd30de))
* unify A2AError hierarchy with transport specific subclasses
([#587](#587))
([4806f8f](4806f8f))


### Bug Fixes

* **client:** bound SSE event size to prevent client-side memory
exhaustion ([#582](#582))
([e6e8ce9](e6e8ce9))
* **client:** cancel the SSE stream on teardown to avoid leaking
connections ([#580](#580))
([83269a5](83269a5))
* **grpc:** preserve null values in protobuf Struct
([#578](#578))
([f447e4e](f447e4e)),
closes [#576](#576)
* resolve sdk compatibility bugs
([#568](#568))
([b57f026](b57f026))
* **server:** await _handleProcessingError so blocking drains surface
errors ([#579](#579))
([5833652](5833652))
* support GET for resubscribe route
([#569](#569))
([8dd43d1](8dd43d1))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: JakubWorek <jakubworek@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants