A2A Protocol

Google Agent-to-Agent Protocol support. Task-based execution with SSE streaming, state history, and automatic skill routing.

Agent Card

The Agent Card is served at the standard A2A discovery endpoint. Any A2A-compatible orchestrator can discover MERX capabilities automatically.

curl https://merx.exchange/.well-known/agent.json

Skills

SkillDescriptionAuth
buy_energyPurchase delegated energy from aggregated marketAPI key
get_pricesCurrent energy prices from all providersNone
analyze_pricesMarket analysis with trends and recommendationsNone
check_balanceAccount balance and on-chain resourcesOptional
ensure_resourcesDeclarative resource provisioningAPI key
create_standing_orderServer-side automation rulesAPI key

Create a Task

Send a task with a DataPart containing an action field, or a TextPart with natural language. The task processor routes to the appropriate skill.

curl -X POST https://merx.exchange/a2a/tasks/send \
  -H "Content-Type: application/json" \
  -H "X-API-Key: sk_live_..." \
  -d '{
    "id": "task-001",
    "message": {
      "role": "user",
      "parts": [{
        "type": "data",
        "data": { "action": "get_prices" }
      }]
    }
  }'

Poll Result

curl https://merx.exchange/a2a/tasks/task-001

SSE Streaming

Subscribe to real-time task state transitions via Server-Sent Events.

curl -N https://merx.exchange/a2a/tasks/task-001/events

Authentication

Pass your API key via the X-API-Key header. Read-only skills (get_prices, analyze_prices, check_balance) work without authentication. Write skills (buy_energy, ensure_resources, create_standing_order) require a key.

Endpoints

MethodPathDescription
GET/.well-known/agent.jsonAgent Card discovery
POST/a2a/tasks/sendCreate and start task
GET/a2a/tasks/:idGet task status and result
GET/a2a/tasks/:id/eventsSSE stream of task events
POST/a2a/tasks/:id/cancelCancel a running task