Deploy API: A2A Server
curl --request POST \
--url http://127.0.0.1:8765/a2a \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"jsonrpc": "<string>",
"method": "<string>",
"id": "<string>",
"params.message.role": "<string>",
"params.message.parts": [
{}
]
}
'import requests
url = "http://127.0.0.1:8765/a2a"
payload = {
"jsonrpc": "<string>",
"method": "<string>",
"id": "<string>",
"params.message.role": "<string>",
"params.message.parts": [{}]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '<string>',
method: '<string>',
id: '<string>',
'params.message.role': '<string>',
'params.message.parts': [{}]
})
};
fetch('http://127.0.0.1:8765/a2a', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8765",
CURLOPT_URL => "http://127.0.0.1:8765/a2a",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '<string>',
'method' => '<string>',
'id' => '<string>',
'params.message.role' => '<string>',
'params.message.parts' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://127.0.0.1:8765/a2a"
payload := strings.NewReader("{\n \"jsonrpc\": \"<string>\",\n \"method\": \"<string>\",\n \"id\": \"<string>\",\n \"params.message.role\": \"<string>\",\n \"params.message.parts\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://127.0.0.1:8765/a2a")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"<string>\",\n \"method\": \"<string>\",\n \"id\": \"<string>\",\n \"params.message.role\": \"<string>\",\n \"params.message.parts\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:8765/a2a")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"<string>\",\n \"method\": \"<string>\",\n \"id\": \"<string>\",\n \"params.message.role\": \"<string>\",\n \"params.message.parts\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_bodyAPI Endpoints
Deploy API: A2A Server
A2A protocol endpoints for agent-to-agent communication
POST
/
a2a
Deploy API: A2A Server
curl --request POST \
--url http://127.0.0.1:8765/a2a \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"jsonrpc": "<string>",
"method": "<string>",
"id": "<string>",
"params.message.role": "<string>",
"params.message.parts": [
{}
]
}
'import requests
url = "http://127.0.0.1:8765/a2a"
payload = {
"jsonrpc": "<string>",
"method": "<string>",
"id": "<string>",
"params.message.role": "<string>",
"params.message.parts": [{}]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '<string>',
method: '<string>',
id: '<string>',
'params.message.role': '<string>',
'params.message.parts': [{}]
})
};
fetch('http://127.0.0.1:8765/a2a', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8765",
CURLOPT_URL => "http://127.0.0.1:8765/a2a",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '<string>',
'method' => '<string>',
'id' => '<string>',
'params.message.role' => '<string>',
'params.message.parts' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://127.0.0.1:8765/a2a"
payload := strings.NewReader("{\n \"jsonrpc\": \"<string>\",\n \"method\": \"<string>\",\n \"id\": \"<string>\",\n \"params.message.role\": \"<string>\",\n \"params.message.parts\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://127.0.0.1:8765/a2a")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"<string>\",\n \"method\": \"<string>\",\n \"id\": \"<string>\",\n \"params.message.role\": \"<string>\",\n \"params.message.parts\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:8765/a2a")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"<string>\",\n \"method\": \"<string>\",\n \"id\": \"<string>\",\n \"params.message.role\": \"<string>\",\n \"params.message.parts\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_bodyA2A API
A2A (Agent-to-Agent) protocol endpoints for agents deployed viaA2A(agent).get_router().
Base URL + Playground
# Start A2A server
from praisonaiagents import Agent
from praisonaiagents.a2a import A2A
import uvicorn
agent = Agent(instructions="You are a helpful assistant")
app = A2A(agent).get_router()
uvicorn.run(app, host="0.0.0.0", port=8000)
http://localhost:8000
Endpoints
GET /.well-known/agent.json
Retrieve the Agent Card for discovery.No parameters required.
curl http://localhost:8000/.well-known/agent.json
import requests
response = requests.get("http://localhost:8000/.well-known/agent.json")
agent_card = response.json()
print(f"Agent: {agent_card['name']}")
print(f"URL: {agent_card['url']}")
print(f"Skills: {[s['name'] for s in agent_card['skills']]}")
const response = await fetch("http://localhost:8000/.well-known/agent.json");
const agentCard = await response.json();
console.log(`Agent: ${agentCard.name}`);
console.log(`URL: ${agentCard.url}`);
{
"name": "Assistant",
"description": "Helpful AI Assistant",
"url": "http://localhost:8000/a2a",
"version": "1.0.0",
"capabilities": {
"streaming": true,
"pushNotifications": false,
"stateTransitionHistory": false
},
"skills": [
{
"id": "chat",
"name": "Chat",
"description": "General conversation"
}
]
}
GET /status
Check server status.No parameters required.
curl http://localhost:8000/status
import requests
response = requests.get("http://localhost:8000/status")
status = response.json()
print(f"Status: {status['status']}")
print(f"Agent: {status['name']}")
{
"status": "ok",
"name": "Assistant",
"version": "1.0.0"
}
POST /a2a
Send JSON-RPC messages to the agent.JSON-RPC version (must be “2.0”)
A2A method name (message/send)
Request ID
Message role (“user”)
Message parts array
curl -X POST http://localhost:8000/a2a \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "message/send",
"id": "request-123",
"params": {
"message": {
"role": "user",
"parts": [
{"type": "text", "text": "Hello, agent!"}
]
}
}
}'
import requests
message = {
"jsonrpc": "2.0",
"method": "message/send",
"id": "request-123",
"params": {
"message": {
"role": "user",
"parts": [{"type": "text", "text": "Hello, agent!"}]
}
}
}
response = requests.post("http://localhost:8000/a2a", json=message)
result = response.json()["result"]
print(f"Agent: {result['message']['parts'][0]['text']}")
const message = {
jsonrpc: "2.0",
method: "message/send",
id: "request-123",
params: {
message: {
role: "user",
parts: [{ type: "text", text: "Hello, agent!" }]
}
}
};
const response = await fetch("http://localhost:8000/a2a", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(message)
});
const { result } = await response.json();
console.log(`Agent: ${result.message.parts[0].text}`);
{
"jsonrpc": "2.0",
"id": "request-123",
"result": {
"message": {
"role": "agent",
"parts": [
{"type": "text", "text": "Hello! How can I help you today?"}
]
}
}
}
Message Part Types
| Type | Fields | Description |
|---|---|---|
text | text | Plain text content |
file | uri, mimeType | File attachment |
Errors
A2A errors follow JSON-RPC 2.0 format:{
"jsonrpc": "2.0",
"id": "request-123",
"error": {
"code": -32600,
"message": "Invalid request"
}
}
| Code | Message |
|---|---|
-32700 | Parse error |
-32600 | Invalid request |
-32601 | Method not found |
-32602 | Invalid params |
-32603 | Internal error |
Related
- A2A Server - Deploy agents as A2A server
- AGUI API - AG-UI protocol endpoints
- Agents API - HTTP REST endpoints
⌘I

