Repository navigation
feat: Add HTTP caching headers to Agent Card endpoint - #761
Conversation
There was a problem hiding this comment.
Code Review
This pull request effectively implements HTTP caching for the Agent Card endpoint by adding Cache-Control, ETag, and Last-Modified headers, as specified. The implementation is well-structured, introducing a dedicated AgentCardCacheMetadata bean to compute and cache these headers at startup. The changes are correctly propagated to both JSON-RPC and REST transports, and the new functionality is validated with a new test case.
I have one suggestion to improve the consistency of ETag generation across different environments. Otherwise, the changes look good.
|
@kabir the CI failure looks genuine |
|
@jmesnil Yep, investigating |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request effectively implements HTTP caching for the Agent Card endpoint as per the A2A specification. The changes are well-structured, introducing an AgentCardCacheMetadata bean to encapsulate the caching logic and cleanly integrating it into the REST and JSON-RPC layers. The tests are also comprehensive, including a new test for the caching headers and appropriate overrides for gRPC.
To improve robustness, I recommend failing fast during application startup in AgentCardCacheMetadata if required dependencies are missing, rather than causing a NullPointerException at runtime.
Overall, this is a great addition that improves performance and compliance with the specification.
Implements A2A specification section 8.6 caching requirements: - Cache-Control header with configurable max-age (CARD-CACHE-001) - ETag header derived from Agent Card content hash (CARD-CACHE-002) - Last-Modified header with initialization timestamp (CARD-CACHE-003) **Implementation:** - Created AgentCardCacheMetadata bean in server-common to compute and cache HTTP headers at initialization - Enhanced HTTPRestResponse to support additional headers via Map - Updated RestHandler and JSON-RPC A2AServerRoutes to include caching headers - Caching headers applied to both REST and JSON-RPC transports (gRPC out of scope per spec) **Configuration:** - Max-age configurable via `a2a.agent-card.cache.max-age` (default: 3600 seconds) - ETag calculated as MD5 hash of serialized Agent Card JSON - Last-Modified set to bean initialization time in RFC 1123 format **Testing:** - Added testAgentCardHeaders() to AbstractA2AServerTest - Validates all three caching headers are present and correctly formatted - gRPC test overrides to skip (HTTP-only requirement) Fixes a2aproject#749 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
@jmesnil Should be fine now |
Implements A2A specification section 8.6 caching requirements: - Cache-Control header with configurable max-age - ETag header derived from Agent Card content hash - Last-Modified header with initialization timestamp **Implementation:** - Created AgentCardCacheMetadata bean in server-common to compute and cache HTTP headers at initialization - Enhanced HTTPRestResponse to support additional headers via Map - Updated RestHandler and JSON-RPC A2AServerRoutes to include caching headers - Caching headers applied to both REST and JSON-RPC transports (gRPC out of scope per spec) **Configuration:** - Max-age configurable via `a2a.agent-card.cache.max-age` (default: 3600 seconds) - ETag calculated as MD5 hash of serialized Agent Card JSON - Last-Modified set to bean initialization time in RFC 1123 format **Testing:** - Added testAgentCardHeaders() to AbstractA2AServerTest - Validates all three caching headers are present and correctly formatted - gRPC test overrides to skip (HTTP-only requirement) Fixes a2aproject#749 🦕 Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>

Implements A2A specification section 8.6 caching requirements:
Implementation:
Configuration:
a2a.agent-card.cache.max-age(default: 3600 seconds)Testing:
Fixes #749 🦕