Skip to content
AGNT
All playbooks
Integrationintermediate

A2A Integration Playbook

Connect your agent to AGNT's agent-to-agent protocol — from first handshake to production E2E tests.

AGNT Developer Relations3 steps60-90 minutesClaude Opus 4.6, Claude Sonnet 4.6

Why this playbook

A2A (Agent-to-Agent) is the protocol that lets AGNT agents talk to external agents — yours included. It handles booking requests, availability checks, and cross-platform actions via structured envelopes with built-in retry logic.

Most A2A integration failures come from three sources: malformed envelopes, missing required fields, and timeout handling. This playbook walks you through the protocol from first principles, then builds production tests that catch all three failure modes.

If you're building a travel agent, a concierge bot, or any service that needs to book venues through AGNT, this is your starting point.

Prerequisites

  • AGNT API key with A2A scope enabled
  • Working knowledge of REST APIs and JSON schemas
  • Claude Code or Codex CLI installed
  • A local development environment (Node.js or Python)

Input requirements

InputTypeRequiredDescription
AGNT API keystring (Bearer token)YesAPI key with A2A scope. Request A2A access from the developer dashboard if not already enabled.
Agent identifierstringYesA unique identifier for your agent (e.g., 'my-concierge-bot'). Used in envelope headers for routing and logging.
Target languagestringNoTypeScript (default) or Python. Determines which SDK and test framework the prompts generate code for.

Step-by-step workflow

1

Authenticate and explore the API surface

Open prompt

Before diving into A2A, you need working API authentication and an understanding of AGNT's data shapes. This prompt scaffolds auth and makes exploratory calls to venues and bookings.

Pay attention to the venue response format — the `booking_methods` field tells you which venues support A2A vs direct booking. You'll filter for A2A-capable venues in step 2.

2

Build and debug A2A envelopes

Open prompt

This prompt teaches the A2A envelope format by building one from scratch. You'll construct a booking request envelope, send it to AGNT's sandbox endpoint, and inspect the response — including the circuit breaker state and retry headers.

The prompt generates a reusable envelope builder function that handles serialization, required field validation, and response parsing. This becomes the foundation for your production integration.

API auth from step 1Agent identifier
3

Write end-to-end A2A integration tests

Open prompt

The final step generates a comprehensive test suite that validates the full A2A lifecycle: send request → receive acknowledgment → poll for result → handle success/failure/timeout.

Tests cover the three most common integration failures: malformed envelopes (caught at send time), missing required fields (caught at validation), and timeouts (caught with exponential backoff). Run these in CI to catch regressions before they hit production.

Envelope builder from step 2API auth from step 1

Expected outputs

TypeScript or Python

API client with auth

Authenticated API client with venue search and booking method filtering.

Produced by step 1
TypeScript or Python module

A2A envelope builder

Reusable envelope construction function with validation, serialization, and response parsing.

Produced by step 2
Jest or pytest

A2A E2E test suite

Integration tests covering the full A2A lifecycle with timeout, retry, and failure handling.

Produced by step 3

Tool requirements

  • Claude Code or Codex CLI
  • AGNT API key (free tier)
  • Node.js 20+ or Python 3.11+

Troubleshooting

Envelope rejected with 'invalid_schema' error
Check the envelope version field — AGNT currently requires 'a2a/v2'. Also verify that the 'intent' field matches a supported action type (book, cancel, check_availability). The debug prompt in step 2 validates all fields before sending.
Sandbox returns 503 during peak hours
The sandbox has lower capacity than production. Retry with exponential backoff (the test suite handles this automatically). For consistent testing, use the mock endpoint documented in the API quickstart output.
Circuit breaker trips after 3 failed requests
Check the X-Circuit-State response header. If it reads 'open', wait for the cooldown period (default: 60 seconds) before retrying. The envelope builder from step 2 includes a circuit state checker that blocks sends during cooldown.

Share as social post

A2A Integration Playbook 3 steps, 60-90 minutes. Connect your agent to AGNT's agent-to-agent protocol — from first handshake to production E2E tests. https://agntdot.com/playbooks/a2a-integration-playbook

206 / 280 chars

Related playbooks

Run the playbook.

Open each prompt in order, feed the outputs forward, and ship the workflow end-to-end.