# abhiramarise/checkout-mandate-agent architecture

> Architecture diagram of the GitHub repository abhiramarise/checkout-mandate-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abhiramarise/checkout-mandate-agent
- Repository: https://github.com/abhiramarise/checkout-mandate-agent

## Overview

Checkout Mandate Agent is a conversational purchasing system that gates payment through signed intent, cart, and payment mandates. The main workflow is a user request, bounded item selection, explicit cart confirmation, payment authorization, and Razorpay order/payment-link creation, with events recorded for audit. The autonomous buyer is a separate optional interaction mode; dispute evidence is another documented capability built from audit records. Some implementation files were not sampled, so those links rely on README statements rather than inspected call sites.

Main entry points: [`agent/core.py`](https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/core.py) (Checkout agent), [`tools/razorpay_client.py`](https://github.com/abhiramarise/checkout-mandate-agent/blob/main/tools/razorpay_client.py) (Razorpay client), [`agent/buyer_agent.py`](https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/buyer_agent.py) (Autonomous buyer), [`agent/audit.py`](https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/audit.py) (Audit logger)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_checkout["Checkout authorization"]
  node_checkout_agent["Checkout agent<br/>[core.py]"]
  node_intent["Intent mandate<br/>[mandates.py]"]
  node_cart["Cart mandate<br/>[mandates.py]"]
  node_payment_mandate["Payment mandate<br/>[mandates.py]"]
  node_catalog[("Product catalog<br/>[catalog.py]")]
end

subgraph group_agents["Agent interaction"]
  node_buyer["Autonomous buyer<br/>[buyer_agent.py]"]
  node_language_model["Groq language model"]
end

subgraph group_payments["Payment integration"]
  node_razorpay_client["Razorpay client<br/>[razorpay_client.py]"]
  node_orders_api["Orders API"]
  node_payment_links_api["Payment Links API"]
end

subgraph group_assurance["Audit and evidence"]
  node_audit_logger["Audit logger<br/>[audit.py]"]
  node_audit_records[("Audit records<br/>[audit.py]")]
  node_evidence_builder["Evidence package<br/>[evidence.py]"]
end

node_user(("User"))

node_user -->|"sends request"| node_checkout_agent
node_checkout_agent -->|"creates mandate"| node_intent
node_checkout_agent -->|"finds item"| node_catalog
node_checkout_agent -->|"proposes cart"| node_cart
node_user -->|"confirms cart"| node_cart
node_checkout_agent -->|"authorizes payment"| node_payment_mandate
node_checkout_agent -->|"requests payment"| node_razorpay_client
node_razorpay_client -->|"creates order"| node_orders_api
node_razorpay_client -->|"creates link"| node_payment_links_api
node_buyer -->|"sends messages"| node_checkout_agent
node_buyer -.->|"phrases messages"| node_language_model
node_checkout_agent -.->|"parses language"| node_language_model
node_checkout_agent -->|"records transitions"| node_audit_logger
node_audit_logger -.->|"writes events"| node_audit_records
node_evidence_builder -->|"reads session"| node_audit_records

click node_checkout_agent "https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/core.py"
click node_intent "https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/mandates.py"
click node_cart "https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/mandates.py"
click node_payment_mandate "https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/mandates.py"
click node_catalog "https://github.com/abhiramarise/checkout-mandate-agent/blob/main/tools/catalog.py"
click node_buyer "https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/buyer_agent.py"
click node_razorpay_client "https://github.com/abhiramarise/checkout-mandate-agent/blob/main/tools/razorpay_client.py"
click node_audit_logger "https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/audit.py"
click node_audit_records "https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/audit.py"
click node_evidence_builder "https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/evidence.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_checkout_agent,node_intent,node_cart,node_payment_mandate,node_catalog,node_user toneBlue
class node_buyer,node_language_model toneAmber
class node_razorpay_client,node_orders_api,node_payment_links_api toneMint
class node_audit_logger,node_audit_records,node_evidence_builder toneRose
```

## Components

### Checkout authorization

- [Checkout agent](https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/core.py): `agent/core.py`
- [Intent mandate](https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/mandates.py): `agent/mandates.py`
- [Cart mandate](https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/mandates.py): `agent/mandates.py`
- [Payment mandate](https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/mandates.py): `agent/mandates.py`
- [Product catalog](https://github.com/abhiramarise/checkout-mandate-agent/blob/main/tools/catalog.py): `tools/catalog.py`

### Agent interaction

- [Autonomous buyer](https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/buyer_agent.py): `agent/buyer_agent.py`
- **Groq language model**

### Payment integration

- [Razorpay client](https://github.com/abhiramarise/checkout-mandate-agent/blob/main/tools/razorpay_client.py): `tools/razorpay_client.py`
- **Orders API**
- **Payment Links API**

### Audit and evidence

- [Audit logger](https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/audit.py): `agent/audit.py`
- [Audit records](https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/audit.py): `agent/audit.py`
- [Evidence package](https://github.com/abhiramarise/checkout-mandate-agent/blob/main/agent/evidence.py): `agent/evidence.py`

### Other components

- **User**

## Connections

- User → Checkout agent: sends request (evidence: `README.md`)
- Checkout agent → Intent mandate: creates mandate (evidence: `README.md`)
- Checkout agent → Product catalog: finds item (evidence: `README.md`)
- Checkout agent → Cart mandate: proposes cart (evidence: `README.md`)
- User → Cart mandate: confirms cart (evidence: `README.md`)
- Checkout agent → Payment mandate: authorizes payment (evidence: `README.md`)
- Checkout agent → Razorpay client: requests payment (evidence: `README.md`)
- Razorpay client → Orders API: creates order (evidence: `tools/razorpay_client.py`)
- Razorpay client → Payment Links API: creates link (evidence: `tools/razorpay_client.py`)
- Autonomous buyer → Checkout agent: sends messages (evidence: `eval/run_multi_agent.py`)
- Autonomous buyer → Groq language model: phrases messages
- Checkout agent → Groq language model: parses language (evidence: `README.md`)
- Checkout agent → Audit logger: records transitions (evidence: `README.md`)
- Audit logger → Audit records: writes events
- Evidence package → Audit records: reads session (evidence: `agent/evidence.py`)
