This guide provides step-by-step instructions on how to run, use, and test the A2A Registry Service (Go implementation).
- Go: Version 1.21 or higher.
- Terminal: Any standard terminal (bash, zsh).
- Curl: For manual API testing.
Start the server using the following command:
# Default port is 3000
go run cmd/server/main.goYou should see logs indicating the server is running on port 3000.
Register a new agent with a full A2A-compliant Agent Card.
Endpoint: POST /api/v1/agents/
Request:
curl -X POST http://localhost:3000/api/v1/agents/ \
-H "Content-Type: application/json" \
-d '{
"agentCard": {
"did": "did:peer:123456789",
"name": "Weather Agent",
"description": "Provides weather updates.",
"protocolVersion": "1.0",
"supportedInterfaces": [
{
"protocolBinding": "HTTP+JSON",
"url": "https://weather-agent.example.com/api/v1"
}
],
"provider": {
"organization": "Weather Corp",
"url": "https://weather.example.com"
},
"capabilities": {
"streaming": true,
"pushNotifications": false
},
"skills": [
{
"name": "GetForecast",
"description": "Returns weather forecast for a location.",
"tags": ["weather", "forecast"]
}
]
},
"tags": ["weather", "public"],
"metadata": {
"region": "us-east"
}
}'Response (201 Created):
Returns the created RegistryEntry with the agentId (which matches the DID).
Get the details of a registered agent using its DID.
Endpoint: GET /api/v1/agents/:agentId
Request:
curl http://localhost:3000/api/v1/agents/did:peer:123456789List all agents, optionally filtering by tags or skills.
Endpoint: GET /api/v1/agents/
Examples:
# List all
curl http://localhost:3000/api/v1/agents/
# Filter by tag
curl "http://localhost:3000/api/v1/agents/?tags=weather"
# Filter by skill name
curl "http://localhost:3000/api/v1/agents/?skill=GetForecast"Agents must send heartbeats to indicate they are active.
Endpoint: POST /api/v1/agents/:agentId/heartbeat
Request:
curl -X POST http://localhost:3000/api/v1/agents/did:peer:123456789/heartbeatRemove an agent from the registry.
Endpoint: DELETE /api/v1/agents/:agentId
Request:
curl -X DELETE http://localhost:3000/api/v1/agents/did:peer:123456789The project includes integration tests that verify the entire flow.
Run All Tests:
go test -v ./tests/...Expected Output:
=== RUN TestRegisterAgent
--- PASS: TestRegisterAgent (0.00s)
=== RUN TestRegisterAgentValidationFailure
--- PASS: TestRegisterAgentValidationFailure (0.00s)
...
PASS
ok github.com/jenish2917/a2a-registry-go/tests 0.515s
The server also listens on port 50051 for gRPC requests.
If you have grpcurl installed, you can interact with the API directly.
List Agents:
grpcurl -plaintext localhost:50051 a2a.registry.v1.RegistryService/ListAgentsGet Agent:
grpcurl -plaintext -d '{"agent_id": "did:peer:123456789"}' localhost:50051 a2a.registry.v1.RegistryService/GetAgentWe have provided a simple Go client to verify connectivity.
Run Client:
go run tools/grpc_client.goThis will connect to localhost:50051 and attempt to list agents.
Postman supports gRPC requests. Follow these steps:
- Create Request: Click "New" -> "gRPC Request".
- Enter URL: Set the server URL to
localhost:50051. - Import Proto:
- Go to the "Service Definition" tab.
- Select "Import .proto file".
- Choose
api/proto/v1/registry.protofrom your project. - Postman will load the
RegistryServiceand its methods.
1. RegisterAgent
Select RegisterAgent method and use this JSON in the "Message" tab:
{
"agent_card": {
"did": "did:peer:postman1",
"name": "Postman Agent",
"protocol_version": "1.0",
"supported_interfaces": [
{
"protocol_binding": "HTTP+JSON",
"url": "http://localhost:4000"
}
]
},
"tags": ["postman", "test"]
}2. GetAgent
Select GetAgent method:
{
"agent_id": "did:peer:postman1"
}3. ListAgents
Select ListAgents method:
{
"limit": 10,
"tags": ["postman"]
}4. Heartbeat
Select Heartbeat method:
{
"agent_id": "did:peer:postman1"
}5. DeleteAgent
Select DeleteAgent method:
{
"agent_id": "did:peer:postman1"
}