Skip to content

Commit 2cd7d98

Browse files
kthota-ga2a-botgemini-code-assist[bot]holtskinner
authored
feat!: Add method for fetching extended card (#929)
# Description This change adds support for a new JSON-RPC method `agent/getAuthenticatedExtendedCard` for fetching authenticated extended card. This is only applicable if `AgentCard.supportsAuthenticatedExtendedCard` bit is set to `true` that allows fetching authenticated context specific agent card. In the previous versions, the extended card was served via `{AgentCard.url}/../agent/authenticatedExtendedCard` endpoint. This endpoint is being removed in favor of the JSON-RPC method. This endpoint will be deprecated in the SDKs and will be removed in a future release. Release-As: 0.3.0 --------- Co-authored-by: a2a-bot <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Holt Skinner <[email protected]>
1 parent 098fd8f commit 2cd7d98

File tree

4 files changed

+174
-29
lines changed

4 files changed

+174
-29
lines changed

docs/llms.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The repository provides:
1818

1919
Key features of the A2A protocol highlighted by the specification and samples include: agent discovery via Agent Cards, standardized task management (send, get, cancel), support for different content types (text, files, structured data) via `Parts` and `Artifacts`, streaming updates for long-running tasks, and mechanisms for push notifications. The project is open source and encourages community contribution.
2020

21-
# A2A (Agent2Agent) Protocol
21+
# A2A (Agent2Agent) Protocol
2222

2323
## 1. Overview
2424

@@ -149,10 +149,9 @@ Key features of the A2A protocol highlighted by the specification and samples in
149149
- `message`: (`Message`) The message to send.
150150
- `configuration`: (`MessageSendConfiguration`) Optional configuration for the message.
151151
- `metadata`: (object) Custom key-value data for client use (optional).
152-
- **`agent/authenticatedExtendedCard`:** (HTTP GET)
152+
- **`agent/getAuthenticatedExtendedCard`:** (JSON-RPC Method)
153153
- Retrieves a potentially more detailed version of the Agent Card after the client has authenticated.
154154
- Available only if `AgentCard.supportsAuthenticatedExtendedCard` is `true`.
155-
- Endpoint URL: `{AgentCard.url}/../agent/authenticatedExtendedCard`
156155
- Authentication: Required using one of the schemes declared in the public `AgentCard.securitySchemes`.
157156
- Response: Complete `AgentCard` object with potentially additional details.
158157

@@ -234,7 +233,7 @@ Key features of the A2A protocol highlighted by the specification and samples in
234233
- **Communication:** Uses `Message` objects containing `Part`s (text, file, data). Task outputs are represented as `Artifact`s, also containing `Part`s.
235234
- **Streaming:** Long-running tasks can provide real-time updates using Server-Sent Events (SSE) via `message/stream`. Updates are sent as `MessageEvent`, `TaskStatusUpdateEvent` and `TaskArtifactUpdateEvent`. Reconnection after interruptions is supported via `tasks/resubscribe`.
236235
- **Push Notifications:** Agents can proactively notify clients about task updates using webhook URLs provided via `tasks/pushNotificationConfig/set`. Authentication mechanisms (e.g., Bearer tokens via JWT signed with keys from agent's JWKS endpoint) are supported for secure communication.
237-
- **Authentication:** Defined in `AgentCard` (via `securitySchemes` and `security` fields) and `PushNotificationConfig`. Can involve various schemes (e.g., API keys, OAuth, JWT). The protocol supports authenticated extended Agent Card retrieval via the `agent/authenticatedExtendedCard` endpoint. Samples use JWT for push notifications and secure communication.
236+
- **Authentication:** Defined in `AgentCard` (via `securitySchemes` and `security` fields) and `PushNotificationConfig`. Can involve various schemes (e.g., API keys, OAuth, JWT). The protocol supports authenticated extended Agent Card retrieval via the `agent/getAuthenticatedExtendedCard` JSON-RPC method. Samples use JWT for push notifications and secure communication.
238237
- **Forms:** Structured data can be requested and submitted using `DataPart` within Messages/Artifacts (demonstrated in ADK sample).
239238

240239
## 4. Security Considerations

docs/specification.md

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,25 +1106,19 @@ The purpose is to resume receiving _subsequent_ updates. The server's behavior r
11061106

11071107
</div>
11081108

1109-
### 7.10. `agent/authenticatedExtendedCard`
1109+
### 7.10. `agent/getAuthenticatedExtendedCard`
11101110

11111111
Retrieves a potentially more detailed version of the Agent Card after the client has authenticated. This endpoint is available only if `AgentCard.supportsAuthenticatedExtendedCard` is `true`.
11121112

1113-
- **Endpoint URL**: `{AgentCard.url}/../agent/authenticatedExtendedCard` (relative to the base URL specified in the public Agent Card).
1114-
- **HTTP Method**: `GET`
11151113
- **Authentication**: The client **MUST** authenticate the request using one of the schemes declared in the public `AgentCard.securitySchemes` and `AgentCard.security` fields.
1116-
- **Request `params`**: None (HTTP GET request).
11171114
- **Response `result` type (on success)**: `AgentCard` (A complete Agent Card object, which may contain additional details or skills not present in the public card).
11181115
- **Response `error` type (on failure)**: Standard HTTP error codes.
11191116
- `401 Unauthorized`: Authentication failed (missing or invalid credentials). The server **SHOULD** include a `WWW-Authenticate` header.
1120-
- `403 Forbidden`: Authentication succeeded, but the client/user is not authorized to access the extended card.
1121-
- `404 Not Found`: The `supportsAuthenticatedExtendedCard` capability is declared, but the server has not implemented this endpoint at the specified path.
1122-
- `5xx Server Error`: An internal server error occurred.
11231117

11241118
<div class="grid cards" markdown>
11251119

11261120
=== "JSON-RPC"
1127-
- **URL:** `agent/authenticatedExtendedCard`
1121+
- **URL:** `agent/getAuthenticatedExtendedCard`
11281122
- **HTTP Method:** `POST`
11291123
- **Payload:** None
11301124
- **Response:** `AgentCard`
@@ -1145,16 +1139,8 @@ Retrieves a potentially more detailed version of the Agent Card after the client
11451139

11461140
Clients retrieving this authenticated card **SHOULD** replace their cached public Agent Card with the content received from this endpoint for the duration of their authenticated session or until the card's version changes.
11471141

1148-
#### 7.10.1. `AuthenticatedExtendedCardParams` Object
1149-
1150-
This endpoint does not use JSON-RPC `params`. Any parameters would be included as HTTP query parameters if needed (though none are defined by the standard).
1151-
1152-
#### 7.10.2. `AuthenticatedExtendedCardResponse` Object
1153-
1154-
The successful response body is a JSON object conforming to the `AgentCard` interface.
1155-
11561142
```ts { .no-copy }
1157-
--8<-- "types/src/types.ts:AuthenticatedExtendedCardResponse"
1143+
--8<-- "types/src/types.ts:GetAuthenticatedExtendedCardSuccessResponse"
11581144
```
11591145

11601146
## 8. Error Handling
@@ -1186,6 +1172,7 @@ These are custom error codes defined within the JSON-RPC server error range (`-3
11861172
| `-32004` | `UnsupportedOperationError` | This operation is not supported | The requested operation or a specific aspect of it (perhaps implied by parameters) is not supported by this server agent implementation. Broader than just method not found. |
11871173
| `-32005` | `ContentTypeNotSupportedError` | Incompatible content types | A [Media Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) provided in the request's `message.parts` (or implied for an artifact) is not supported by the agent or the specific skill being invoked. |
11881174
| `-32006` | `InvalidAgentResponseError` | Invalid agent response type | Agent generated an invalid response for the requested method |
1175+
| `-32007` | `AuthenticatedExtendedCardNotConfiguredError` | Authenticated Extended Card not configured | The agent does not have an Authenticated Extended Card configured.|
11891176

11901177
Servers MAY define additional error codes within the `-32000` to `-32099` range for more specific scenarios not covered above, but they **SHOULD** document these clearly. The `data` field of the `JSONRPCError` object can be used to provide more structured details for any error.
11911178

@@ -1209,16 +1196,19 @@ This section provides illustrative JSON examples of common A2A interactions. Tim
12091196

12101197
3. **Client obtains necessary credentials out-of-band (e.g., performs OAuth 2.0 flow with Google, resulting in an access token).**
12111198

1212-
4. **Client fetches the authenticated extended Agent Card:**
1199+
4. **Client fetches the authenticated extended Agent Card using `agent/getAuthenticatedExtendedCard` request:**
12131200

1214-
```none
1215-
GET https://example.com/a2a/agent/authenticatedExtendedCard
1216-
Authorization: Bearer <obtained_access_token>
1201+
```json
1202+
{
1203+
"jsonrpc": "2.0",
1204+
"id": 1,
1205+
"method": "agent/getAuthenticatedExtendedCard"
1206+
}
12171207
```
12181208

12191209
5. **Server authenticates and authorizes the request.**
12201210

1221-
6. **Server responds with the full Agent Card:**
1211+
6. **Server responds with the full Agent Card as the JSON-RPC result:**
12221212

12231213
### 9.2. Basic Execution (Synchronous / Polling Style)
12241214

specification/json/a2a.json

Lines changed: 102 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/src/types.ts

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,8 @@ export type JSONRPCResponse =
941941
| SetTaskPushNotificationConfigResponse
942942
| GetTaskPushNotificationConfigResponse
943943
| ListTaskPushNotificationConfigResponse
944-
| DeleteTaskPushNotificationConfigResponse;
944+
| DeleteTaskPushNotificationConfigResponse
945+
| GetAuthenticatedExtendedCardResponse;
945946
// --8<-- [end:JSONRPCResponse]
946947

947948
// --8<-- [start:SendMessageRequest]
@@ -1231,6 +1232,40 @@ export type DeleteTaskPushNotificationConfigResponse =
12311232
| JSONRPCErrorResponse;
12321233
// --8<-- [end:DeleteTaskPushNotificationConfigResponse]
12331234

1235+
// --8<-- [start:GetAuthenticatedExtendedCardRequest]
1236+
/**
1237+
* Represents a JSON-RPC request for the `agent/getAuthenticatedExtendedCard` method.
1238+
*/
1239+
export interface GetAuthenticatedExtendedCardRequest extends JSONRPCRequest {
1240+
/** The identifier for this request. */
1241+
id: number | string;
1242+
/** The method name. Must be 'agent/getAuthenticatedExtendedCard'. */
1243+
readonly method: "agent/getAuthenticatedExtendedCard";
1244+
/** This method does not accept parameters. */
1245+
params?: never;
1246+
}
1247+
// --8<-- [end:GetAuthenticatedExtendedCardRequest]
1248+
1249+
// --8<-- [start:GetAuthenticatedExtendedCardSuccessResponse]
1250+
/**
1251+
* Represents a successful JSON-RPC response for the `agent/getAuthenticatedExtendedCard` method.
1252+
*/
1253+
export interface GetAuthenticatedExtendedCardSuccessResponse
1254+
extends JSONRPCSuccessResponse {
1255+
/** The result is an Agent Card object. */
1256+
result: AgentCard;
1257+
}
1258+
// --8<-- [end:GetAuthenticatedExtendedCardSuccessResponse]
1259+
1260+
// --8<-- [start:GetAuthenticatedExtendedCardResponse]
1261+
/**
1262+
* Represents a JSON-RPC response for the `agent/getAuthenticatedExtendedCard` method.
1263+
*/
1264+
export type GetAuthenticatedExtendedCardResponse =
1265+
| GetAuthenticatedExtendedCardSuccessResponse
1266+
| JSONRPCErrorResponse;
1267+
// --8<-- [end:GetAuthenticatedExtendedCardResponse]
1268+
12341269
// --8<-- [start:A2ARequest]
12351270
/**
12361271
* A discriminated union representing all possible JSON-RPC 2.0 requests supported by the A2A specification.
@@ -1244,7 +1279,8 @@ export type A2ARequest =
12441279
| GetTaskPushNotificationConfigRequest
12451280
| TaskResubscriptionRequest
12461281
| ListTaskPushNotificationConfigRequest
1247-
| DeleteTaskPushNotificationConfigRequest;
1282+
| DeleteTaskPushNotificationConfigRequest
1283+
| GetAuthenticatedExtendedCardRequest;
12481284
// --8<-- [end:A2ARequest]
12491285

12501286
// --8<-- [start:JSONParseError]
@@ -1414,6 +1450,23 @@ export interface InvalidAgentResponseError extends JSONRPCError {
14141450
}
14151451
// --8<-- [end:InvalidAgentResponseError]
14161452

1453+
// --8<-- [start:AuthenticatedExtendedCardNotConfiguredError]
1454+
/**
1455+
* An A2A-specific error indicating that the agent does not have an
1456+
* Authenticated Extended Card configured
1457+
*/
1458+
export interface AuthenticatedExtendedCardNotConfiguredError
1459+
extends JSONRPCError {
1460+
/** The error code for when an authenticated extended card is not configured. */
1461+
readonly code: -32007;
1462+
/**
1463+
* The error message.
1464+
* @default "Authenticated Extended Card not configured"
1465+
*/
1466+
message: string;
1467+
}
1468+
// --8<-- [end:AuthenticatedExtendedCardNotConfiguredError]
1469+
14171470
// --8<-- [start:A2AError]
14181471
/**
14191472
* A discriminated union of all standard JSON-RPC and A2A-specific error types.
@@ -1429,5 +1482,6 @@ export type A2AError =
14291482
| PushNotificationNotSupportedError
14301483
| UnsupportedOperationError
14311484
| ContentTypeNotSupportedError
1432-
| InvalidAgentResponseError;
1485+
| InvalidAgentResponseError
1486+
| AuthenticatedExtendedCardNotConfiguredError;
14331487
// --8<-- [end:A2AError]

0 commit comments

Comments
 (0)