A2A Inspector
repository·main·Indexed 19 days ago
https://github.com/a2aproject/a2a-inspectorA web-based debugging tool for the Agent2Agent (A2A) protocol. It enables developers to validate agent cards, interact with agents via a live chat interface, and inspect raw JSON-RPC 2.0 communication through a debug console.
What's inside a2a-inspector
- The A2A Inspector is a web-based tool for developers to inspect, debug, and validate servers implementing the A2A (Agent2Agent) protocol. It allows you to connect to an A2A agent via a base URL, view the agent's card, perform specification compliance checks, interact via a live chat interface, and debug raw JSON-RPC 2.0 messages through a slide-out debug console.
Install and set up the A2A Inspector locally
mainTo run the A2A Inspector locally for development, follow these steps to clone the repository, install Python dependencies using
uv, and install Node.js dependencies for the frontend.1. Clone the repository
git clone https://github.com/a2aproject/a2a-inspector.git cd a2a-inspector2. Install Dependencies
Backend (Python): From the root directory, use
uv syncto install exact package versions into a virtual environment.uv syncFrontend (Node.js): Navigate to the
frontenddirectory and usenpmto install packages.cd frontend npm install cd ..git clone https://github.com/a2aproject/a2a-inspector.git cd a2a-inspector uv sync cd frontend npm install cd ..Run the A2A Inspector locally for development
mainFor active development with live-reloading for both frontend and backend, use one of the following two methods.
Method 1: Using the convenience script (Recommended)
This script starts both the frontend build process and the backend server simultaneously.
chmod +x scripts/run.sh bash scripts/run.shMethod 2: Manual execution in separate terminals
If you prefer running processes manually, open two terminals from the project root:
Terminal 1 (Frontend):
cd frontend npm run build -- --watchTerminal 2 (Backend):
cd backend uv run app.pyOnce running, access the inspector at http://127.0.0.1:5001.
# Recommended way chmod +x scripts/run.sh bash scripts/run.shRun the A2A Inspector using Docker
mainIf you want to run the application without managing local Python or Node.js environments, use Docker. This builds the entire application (frontend and backend) into a single container.
- Build the image:
docker build -t a2a-inspector .- Run the container: Run the container in detached mode, mapping port 8080.
docker run -d -p 8080:8080 a2a-inspectorOnce running, access the inspector at http://127.0.0.1:8080.
docker build -t a2a-inspector . docker run -d -p 8080:8080 a2a-inspectorDebug logs and observability via Socket.IO
mainThe inspector provides real-time debugging information via the
debug_logSocket.IO event. This allows developers to see the raw request/response lifecycle between the inspector and the agent.Event:
debug_log- Payload:
type: The category of the log (e.g.,request,response,http-agent-card).data: The actual payload being logged.id: The ID associated with the event (e.g., the message ID or request ID).
- Payload:
Fetch an Agent Card via POST /agent-card
mainThe
/agent-cardendpoint allows you to fetch and validate an A2A Agent Card from a specific URL. This is useful for inspecting the capabilities and configuration of an agent before establishing a full connection.Request Body Requirements:
url: The URL of the agent card.sid: A session ID (provided by the frontend/client) used for correlating debug logs.custom_headers: (Optional) Any non-standard HTTP headers to include in the request to the agent.
Response:
- Returns a JSON object containing the
carddata and anyvalidation_errorsfound during the process. - Returns
400if required fields are missing. - Returns
502if the agent is unreachable. - Returns
500on internal server errors.
{ "url": "https://agent.example.com/card.json", "sid": "some-session-id" }Send a message to an agent via Socket.IO
mainOnce a client is initialized, use the
send_messageevent to communicate with the agent. The backend handles message construction, including text parts and file attachments.Event:
send_message- Payload:
message: The text content of the message.id: (Optional) A unique ID for the message. If not provided, a UUID is generated.contextId: (Optional) Used for multi-turn conversation tracking.metadata: (Optional) Additional metadata for the message.attachments: (Optional) A list of attachment objects.data: The raw bytes of the file.mimeType: The MIME type of the file.
Response (
agent_responseevent):- The backend streams responses from the agent. Each response is emitted as an
agent_responseevent. - The response payload includes the
id(correlated to the request ID) and the actual event data (e.g.,Task,Message,TaskStatusUpdateEvent). - The backend also emits
debug_logevents for observability.
// Example Socket.IO client-side call socket.emit('send_message', { message: 'Hello, agent!', id: 'msg-123', attachments: [ { data: [0x01, 0x02, 0x03], // ArrayBuffer or similar mimeType: 'application/octet-stream' } ] }); socket.on('agent_response', (response) => { console.log('Received response:', response); });- Payload:
Initialize an A2A Client via Socket.IO
mainTo start a session with an agent, emit the
initialize_clientevent over Socket.IO. This sets up theA2ACardResolver, creates aClientusing theClientFactory, and prepares the transport protocol.Event:
initialize_client- Payload:
url: The Agent Card URL.customHeaders: (Optional) A dictionary of custom headers to use for the client connection.
Success Response (
client_initializedevent):status: "success"transport: The protocol being used (e.g.,jsonrpc,http_json,grpc).inputModes: List of supported input modes (e.g.,['text/plain']).outputModes: List of supported output modes.
Error Response (
client_initializedevent):status: "error"message: Description of the error.
// Example Socket.IO client-side call socket.emit('initialize_client', { url: 'https://agent.example.com/card.json', customHeaders: { 'Authorization': 'Bearer token' } }); socket.on('client_initialized', (data) => { console.log(data.status, data.transport); });- Payload: