From 95f8f1f0db7c2b4bf29548c0e6e7119688d8479a Mon Sep 17 00:00:00 2001 From: Brian O'Kelley Date: Sat, 20 Sep 2025 11:29:55 -0400 Subject: [PATCH] Fix A2A protocol implementation for AdCP compliance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update A2A client to use structured data format instead of natural language - Change message parts from 'text' to 'data' with skill/parameters structure - Update agent configuration URLs to test-agent.adcontextprotocol.org - Update documentation with correct agent endpoints This fixes authentication and message format issues with A2A agents. The agent now properly receives skill calls with structured parameters as specified in the AdCP protocol. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .env.example | 2 +- CLAUDE.md | 14 +++++++------- PRODUCTION-READY.md | 14 +++++++------- src/a2a-client.ts | 13 ++++++++----- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/.env.example b/.env.example index a826f74b4..e88b43a2b 100644 --- a/.env.example +++ b/.env.example @@ -7,7 +7,7 @@ LOG_LEVEL=info # Sales Agents Configuration (JSON string) # Replace with your actual agent endpoints and authentication tokens # For local testing, you can use the test MCP server: -SALES_AGENTS_CONFIG='{"agents": [{"id": "test_mcp_local", "name": "Local Test MCP Server", "agent_uri": "http://127.0.0.1:3001/mcp", "protocol": "mcp", "requiresAuth": false}, {"id": "demo_agent_a2a", "name": "Demo A2A Agent", "agent_uri": "https://your-agent-endpoint.com", "protocol": "a2a", "auth_token_env": "your-actual-auth-token-here", "requiresAuth": true}, {"id": "demo_agent_mcp", "name": "Demo MCP Agent", "agent_uri": "https://your-agent-endpoint.com/mcp", "protocol": "mcp", "auth_token_env": "your-actual-auth-token-here", "requiresAuth": true}]}' +SALES_AGENTS_CONFIG='{"agents": [{"id": "test_mcp_local", "name": "Local Test MCP Server", "agent_uri": "http://127.0.0.1:3001/mcp", "protocol": "mcp", "requiresAuth": false}, {"id": "demo_agent_a2a", "name": "Demo A2A Agent", "agent_uri": "https://test-agent.adcontextprotocol.org", "protocol": "a2a", "auth_token_env": "your-actual-auth-token-here", "requiresAuth": true}, {"id": "demo_agent_mcp", "name": "Demo MCP Agent", "agent_uri": "https://test-agent.adcontextprotocol.org/mcp", "protocol": "mcp", "auth_token_env": "your-actual-auth-token-here", "requiresAuth": true}]}' # Test MCP Server Configuration MCP_SERVER_PORT=3001 diff --git a/CLAUDE.md b/CLAUDE.md index d5d07cd23..9dca5ac4a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -241,7 +241,7 @@ The production `SALES_AGENTS_CONFIG` should contain: { "id": "principal_3bd0d4a8_a2a", "name": "AdCP Test Agent", - "agent_uri": "https://adcp-sales-agent.fly.dev", + "agent_uri": "https://test-agent.adcontextprotocol.org", "protocol": "a2a", "auth_token_env": "", "requiresAuth": true @@ -249,7 +249,7 @@ The production `SALES_AGENTS_CONFIG` should contain: { "id": "principal_3bd0d4a8_mcp", "name": "AdCP Test Agent", - "agent_uri": "https://adcp-sales-agent.fly.dev/mcp/", + "agent_uri": "https://test-agent.adcontextprotocol.org/mcp/", "protocol": "mcp", "auth_token_env": "", "requiresAuth": true @@ -265,7 +265,7 @@ When you need to change agents, auth tokens, or URIs: ```bash # Single line format for terminal (replace with actual token) -fly secrets set SALES_AGENTS_CONFIG='{"agents":[{"id":"principal_3bd0d4a8_a2a","name":"AdCP Test Agent","agent_uri":"https://adcp-sales-agent.fly.dev","protocol":"a2a","auth_token_env":"","requiresAuth":true},{"id":"principal_3bd0d4a8_mcp","name":"AdCP Test Agent","agent_uri":"https://adcp-sales-agent.fly.dev/mcp/","protocol":"mcp","auth_token_env":"","requiresAuth":true}]}' +fly secrets set SALES_AGENTS_CONFIG='{"agents":[{"id":"principal_3bd0d4a8_a2a","name":"AdCP Test Agent","agent_uri":"https://test-agent.adcontextprotocol.org","protocol":"a2a","auth_token_env":"","requiresAuth":true},{"id":"principal_3bd0d4a8_mcp","name":"AdCP Test Agent","agent_uri":"https://test-agent.adcontextprotocol.org/mcp/","protocol":"mcp","auth_token_env":"","requiresAuth":true}]}' ``` #### Toggle Real vs Demo Agents @@ -299,8 +299,8 @@ fly logs -n | grep "Configured agents" Should show: ``` 📡 Configured agents: 2 - - AdCP Test Agent (A2A) at https://adcp-sales-agent.fly.dev - - AdCP Test Agent (MCP) at https://adcp-sales-agent.fly.dev/mcp/ + - AdCP Test Agent (A2A) at https://test-agent.adcontextprotocol.org + - AdCP Test Agent (MCP) at https://test-agent.adcontextprotocol.org/mcp/ 🔧 Real agents mode: ENABLED ``` @@ -322,8 +322,8 @@ Should show: 3. **Agent not responding**: Check agent health: ```bash - curl -I https://adcp-sales-agent.fly.dev - curl -I https://adcp-sales-agent.fly.dev/mcp/ + curl -I https://test-agent.adcontextprotocol.org + curl -I https://test-agent.adcontextprotocol.org/mcp/ ``` 4. **Authentication issues**: Verify auth token in agent config and ensure `requiresAuth: true` diff --git a/PRODUCTION-READY.md b/PRODUCTION-READY.md index bc3399957..b89ed4071 100644 --- a/PRODUCTION-READY.md +++ b/PRODUCTION-READY.md @@ -3,8 +3,8 @@ ## ✅ What's Configured for Production ### **Real Agent Integration** -- **Test A2A Agent**: `https://adcp-sales-agent.fly.dev` -- **Test MCP Agent**: `https://adcp-sales-agent.fly.dev/mcp` +- **Test A2A Agent**: `https://test-agent.adcontextprotocol.org` +- **Test MCP Agent**: `https://test-agent.adcontextprotocol.org/mcp` - **Protocol Support**: Both A2A and MCP protocols with real HTTP requests ### **Deployment Configuration** @@ -30,14 +30,14 @@ fly secrets set 'SALES_AGENTS_CONFIG={ { "id": "test_agent_a2a", "name": "Test A2A Agent", - "agent_uri": "https://adcp-sales-agent.fly.dev", + "agent_uri": "https://test-agent.adcontextprotocol.org", "protocol": "a2a", "requiresAuth": false }, { "id": "test_agent_mcp", "name": "Test MCP Agent", - "agent_uri": "https://adcp-sales-agent.fly.dev/mcp", + "agent_uri": "https://test-agent.adcontextprotocol.org/mcp", "protocol": "mcp", "requiresAuth": false } @@ -56,14 +56,14 @@ fly certs add testing.adcontextprotocol.org ### A2A Agent - **ID**: `test_agent_a2a` - **Name**: `Test A2A Agent` -- **Endpoint**: `https://adcp-sales-agent.fly.dev` +- **Endpoint**: `https://test-agent.adcontextprotocol.org` - **Protocol**: `a2a` - **Auth**: No authentication required for testing ### MCP Agent - **ID**: `test_agent_mcp` - **Name**: `Test MCP Agent` -- **Endpoint**: `https://adcp-sales-agent.fly.dev/mcp` +- **Endpoint**: `https://test-agent.adcontextprotocol.org/mcp` - **Protocol**: `mcp` - **Auth**: No authentication required for testing @@ -85,7 +85,7 @@ curl -X POST https://testing.adcontextprotocol.org/api/test \ { "id": "test_agent_a2a", "name": "Test A2A Agent", - "agent_uri": "https://adcp-sales-agent.fly.dev", + "agent_uri": "https://test-agent.adcontextprotocol.org", "protocol": "a2a", "requiresAuth": false } diff --git a/src/a2a-client.ts b/src/a2a-client.ts index cbdfc1349..2f04d42f3 100644 --- a/src/a2a-client.ts +++ b/src/a2a-client.ts @@ -37,11 +37,14 @@ export async function callA2ATool( messageId: `msg_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, role: "user", parts: [{ - kind: "text", - text: `Please execute ${toolName} with the following parameters: ${JSON.stringify({ - brief, - ...(promotedOffering && { promoted_offering: promotedOffering }) - })}` + kind: "data", + data: { + skill: toolName, + parameters: { + brief, + ...(promotedOffering && { promoted_offering: promotedOffering }) + } + } }] }, configuration: {