Skip to content

Using the A2A Protocol in a Gift Card Platform โ€‹

The A2A Protocol is an open standard that allows autonomous agents to communicate, negotiate, and collaborate over HTTP. For a gift card platform, it enables seamless integration between agents handling tasks like payment processing, fraud checks, gift card issuance, and deliveryโ€”without custom wiring between services.

Key Roles in the Workflow โ€‹

  • ClientAgent: Frontend-facing agent that interacts with the user.
  • IdentityAgent: Resolves recipient names to email addresses using contact books, social connections, and user preferences.
  • PaymentAgent: Handles payment collection and authorization.
  • FraudAgent: Screens for fraud or abuse signals.
  • IssuerAgent: Issues the Acme gift card.
  • DeliveryAgent: Sends the gift card via email, SMS, or API.

End-to-End Workflow โ€‹

1. User Request โ€‹

The user says:

"Send a $50 Acme gift card to Sarah."

The ClientAgent parses this intent and initiates a task for gift card purchase.

2. Agent Discovery โ€‹

The ClientAgent locates required agents by querying public or private AgentCards:

  • IdentityAgent resolves recipient names to email addresses
  • IssuerAgent supports Acme gift cards
  • PaymentAgent accepts ACH, card, or crypto
  • FraudAgent accepts identity and device info
  • DeliveryAgent supports email

Discovery is done via the A2A protocol's open registry or internal directories.

3. Identity Resolution โ€‹

The ClientAgent submits a task to the IdentityAgent to resolve "Sarah" to a specific email address:

json
{
  "task": "resolve_recipient",
  "data": {
    "recipient_name": "Sarah",
    "context": {
      "sender_email": "user@example.com",
      "relationship": "friend",
      "platform": "gift_card"
    }
  }
}

The IdentityAgent responds with the resolved email address:

json
{
  "result": "success",
  "data": {
    "email": "sarah@example.com",
    "confidence": 0.95,
    "source": "contact_book"
  }
}

If the identity cannot be resolved, the agent may request additional information or suggest alternative recipients.

4. Fraud Check โ€‹

Before payment or issuance, the ClientAgent submits a task to the FraudAgent:

json
{
  "task": "evaluate",
  "data": {
    "email": "sarah@example.com",
    "ip": "192.0.2.10",
    "device": "iPhone",
    "amount": 50
  }
}

If the result is "approved", the workflow continues.

5. Payment Collection โ€‹

The PaymentAgent initiates a transaction task:

json
{
  "task": "charge",
  "data": {
    "amount": 50,
    "currency": "USD",
    "method": "credit_card",
    "card_token": "tok_abc123"
  }
}

If payment succeeds, the PaymentAgent returns a receipt or transaction ID.

6. Gift Card Issuance โ€‹

The IssuerAgent receives a task:

json
{
  "task": "issue_card",
  "data": {
    "brand": "Acme",
    "value": 50,
    "currency": "USD",
    "reference": "txn_456"
  }
}

It responds with the card code (e.g. ACME-XYZ-123) and optional metadata.

7. Delivery โ€‹

The DeliveryAgent is then asked to send the card:

json
{
  "task": "send",
  "data": {
    "to": "sarah@example.com",
    "message": "Here's your Acme gift card!",
    "attachment": {
      "type": "code",
      "value": "ACME-XYZ-123"
    }
  }
}

Confirmation is logged or returned as part of the final task result.


Benefits of A2A in This Context โ€‹

AreaBenefit
ModularityEach function (fraud, payments, issuance) is handled by its own agent.
FlexibilityEasily swap out or add new agents without rewriting core logic.
SecurityAgents only expose capabilities and endpoints via AgentCardsโ€”internal logic stays private.
InteroperabilityThird-party agents (e.g., payment processors or fraud providers) can be integrated via A2A without custom APIs.

Example AgentCard (Simplified) โ€‹

json
{
  "id": "https://issuer.example.com/a2a.json",
  "name": "AcmeIssuerAgent",
  "capabilities": [
    {
      "task": "issue_card",
      "input": { "brand": "Acme", "value": "number" },
      "output": { "code": "string" }
    }
  ]
}

Final Thoughts โ€‹

Using the A2A Protocol helps create a highly composable platform. Tasks like fraud checks, payments, and delivery can be assigned to specialized agents that communicate using a shared protocolโ€”reducing the need for tight coupling or hardcoded flows.

This approach makes it easier to scale, swap vendors, and add new capabilities without redesigning the system.