You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit eecbc5a
Browse filesBrowse the repository at this point in the historyBrowse files
The examples in the rest of this page use `grpcurl` to call the gRPC transport. The controller serves the same service over HTTP/JSON-RPC on the same port `8083`; the `Call it over HTTP` section near the end of this page shows the equivalent `curl` calls.
58
+
57
59
## Read the agent card
58
60
59
61
An A2A client typically starts by reading the agent card, which tells it what the agent is and which protocol features the agent supports.
@@ -479,6 +481,40 @@ Answering a pause needs the human-in-the-loop extension, which a caller requests
479
481
480
482
A tool approval works in the same way, but the agent sends `tool_approval_request`, and the caller answers with `tool_approval_response`. For the pause kinds, the approval model, and what a nested agent's pause looks like, see [Human in the loop]({{< link path="agents/human-in-the-loop" >}}).
481
483
484
+
## Call it over HTTP
485
+
486
+
The examples so far call the gRPC transport with `grpcurl`. The controller serves the same service over HTTP/JSON-RPC on the same port `8083`, where the URL path selects the Agent instead of a `tenant` field. Both forms below reach the same service the `grpcurl` examples use, with the same `A2A-Version: 1.0` header.
487
+
488
+
1. Read the Agent's card with the JSON-RPC interface URL.
The card advertises the JSON-RPC URL first, then the gRPC interface. Point every JSON-RPC call at the first `supportedInterfaces` entry, whose `url` is `http://<controller>/agents/<namespace>/<name>`. A hand-assembled HTTP call sets the Agent in the URL and needs no `tenant`; a `tenant` that an HTTP request does supply must match its URL.
494
+
495
+
2. Send a message with a JSON-RPC `2.0` request. The body mirrors the `SendMessage` call from [Send a message](#send-a-message): `messageId`, `role`, and at least one `parts` entry. Omitting both a `contextId` and a task ID starts a new Session.
496
+
```bash
497
+
curl -s -X POST localhost:8083/agents/kagent/my-first-agent \
498
+
-H 'Content-Type: application/json' \
499
+
-H 'A2A-Version: 1.0' \
500
+
-d '{
501
+
"jsonrpc": "2.0",
502
+
"id": "request-1",
503
+
"method": "SendMessage",
504
+
"params": {
505
+
"message": {
506
+
"messageId": "'$(uuidgen)'",
507
+
"role": "ROLE_USER",
508
+
"parts": [{"text": "What is 7 times 6? Answer with just the number."}]
509
+
}
510
+
}
511
+
}'
512
+
```
513
+
514
+
The reply is the same task the `SendMessage` gRPC call returns: the answer arrives in `artifacts`, and `contextId` is the Session ID to repeat on a follow-up message.
515
+
516
+
3. The JSON-RPC surface uses the pinned upstream A2A v1 SDK method names: `SendMessage`, `SendStreamingMessage` (streams events over the same `POST` endpoint), `GetTask`, `ListTasks`, `CancelTask`, `SubscribeToTask`, and `GetExtendedAgentCard`. Those are the v1 names for what older A2A clients called `message/send`, `message/stream`, `tasks/get`, `tasks/list`, `tasks/cancel`, and `tasks/resubscribe`.
517
+
482
518
## Clean up
483
519
484
520
* This example does not create Kubernetes resources, so you have nothing to delete.
The examples in the rest of this page use `grpcurl` to call the gRPC transport. The controller serves the same service over HTTP/JSON-RPC on the same port `8083`; the `Call it over HTTP` section near the end of this page shows the equivalent `curl` calls.
58
+
57
59
## Read the agent card
58
60
59
61
An A2A client typically starts by reading the agent card, which tells it what the agent is and which protocol features the agent supports.
@@ -479,6 +481,40 @@ Answering a pause needs the human-in-the-loop extension, which a caller requests
479
481
480
482
A tool approval works in the same way, but the agent sends `tool_approval_request`, and the caller answers with `tool_approval_response`. For the pause kinds, the approval model, and what a nested agent's pause looks like, see [Human in the loop]({{< link path="agents/human-in-the-loop" >}}).
481
483
484
+
## Call it over HTTP
485
+
486
+
The examples so far call the gRPC transport with `grpcurl`. The controller serves the same service over HTTP/JSON-RPC on the same port `8083`, where the URL path selects the Agent instead of a `tenant` field. Both forms below reach the same service the `grpcurl` examples use, with the same `A2A-Version: 1.0` header.
487
+
488
+
1. Read the Agent's card with the JSON-RPC interface URL.
The card advertises the JSON-RPC URL first, then the gRPC interface. Point every JSON-RPC call at the first `supportedInterfaces` entry, whose `url` is `http://<controller>/agents/<namespace>/<name>`. A hand-assembled HTTP call sets the Agent in the URL and needs no `tenant`; a `tenant` that an HTTP request does supply must match its URL.
494
+
495
+
2. Send a message with a JSON-RPC `2.0` request. The body mirrors the `SendMessage` call from [Send a message](#send-a-message): `messageId`, `role`, and at least one `parts` entry. Omitting both a `contextId` and a task ID starts a new Session.
496
+
```bash
497
+
curl -s -X POST localhost:8083/agents/kagent/my-first-agent \
498
+
-H 'Content-Type: application/json' \
499
+
-H 'A2A-Version: 1.0' \
500
+
-d '{
501
+
"jsonrpc": "2.0",
502
+
"id": "request-1",
503
+
"method": "SendMessage",
504
+
"params": {
505
+
"message": {
506
+
"messageId": "'$(uuidgen)'",
507
+
"role": "ROLE_USER",
508
+
"parts": [{"text": "What is 7 times 6? Answer with just the number."}]
509
+
}
510
+
}
511
+
}'
512
+
```
513
+
514
+
The reply is the same task the `SendMessage` gRPC call returns: the answer arrives in `artifacts`, and `contextId` is the Session ID to repeat on a follow-up message.
515
+
516
+
3. The JSON-RPC surface uses the pinned upstream A2A v1 SDK method names: `SendMessage`, `SendStreamingMessage` (streams events over the same `POST` endpoint), `GetTask`, `ListTasks`, `CancelTask`, `SubscribeToTask`, and `GetExtendedAgentCard`. Those are the v1 names for what older A2A clients called `message/send`, `message/stream`, `tasks/get`, `tasks/list`, `tasks/cancel`, and `tasks/resubscribe`.
517
+
482
518
## Clean up
483
519
484
520
* This example does not create Kubernetes resources, so you have nothing to delete.
0 commit comments