Skip to main content
Glama
siddiquafathima

deskkit-agentic-commerce

README.md
# DeskKit — Agentic Commerce for Razorpay AI Buildathon

**Track 1: AI Growth & Agentic Commerce**

An autonomous procurement agent that makes a merchant (DeskKit) transactable by an AI buyer, end to end — with every money action explainable, bounded, and gated, and a live audit trail.

## What it does

DeskKit is a small office-supplies merchant on Razorpay. This project builds an AI agent that:
- Browses DeskKit's catalog via an **MCP tool interface** (agent-readable catalog)
- Reasons about purchases and executes **real Razorpay test-mode orders**
- Enforces a strict monthly budget with two-tier gating: auto-approve under ₹3,000, manual approval required above it, hard block if it would exceed ₹5,000/month
- **Persists spend across sessions** — the budget genuinely behaves like a monthly limit, not a per-run reset
- Proactively **suggests complementary items** (upsell/cross-sell) after a successful purchase
- Includes a **second AI agent** that autonomously generates procurement requests — demonstrating real agent-to-agent commerce, not just human-to-agent

Every decision is traced in **LangSmith** for a full audit trail, and visualized live in a **Monthly Ledger dashboard** showing approved/pending/blocked counts and order history.

## Why this matches the track

> "Every money action explainable, bounded and gated. Show the audit trail and one failure handled gracefully."

This project handles **four distinct failure/edge cases gracefully**: budget block, approval gate, requests for items not in the catalog, and partial fulfillment of an over-scoped agent-to-agent request — each with clear reasoning and real alternatives, never a silent failure or forced override.

## Architecture
Requester Agent (AI buyer) ──> LangGraph ReAct Agent ──> MCP Tool Layer ──> Razorpay Test-Mode API
│ │
│ ├── get_catalog
│ └── create_order (budget-gated)
│
└──> LangSmith (audit trail)


## Tech stack

- **FastAPI** — backend + UI
- **LangGraph** (ReAct agent pattern) — reasoning and tool orchestration
- **MCP (Model Context Protocol)** — catalog and checkout exposed as agent-callable tools
- **Groq (openai/gpt-oss-120b)** — LLM inference
- **Razorpay Python SDK** — real test-mode payment orders
- **LangSmith** — observability and audit trail
- Persistent JSON-based spend tracking

## Running it locally

```bash
python -m venv venv
venv\Scripts\activate          # on Windows
pip install -r requirements.txt
```

Create a `.env` file with:
RAZORPAY_KEY_ID=your_test_key
RAZORPAY_KEY_SECRET=your_test_secret
GROQ_API_KEY=your_groq_key
LANGSMITH_API_KEY=your_langsmith_key
LANGSMITH_TRACING=true
LANGSMITH_PROJECT=deskkit-buildathon


Then run:
```bash
uvicorn main:app --reload
```

Visit `http://127.0.0.1:8000`.

## Demo

Type an instruction (e.g. *"Buy 10 USB-C cables and 1 laptop stand"*), or click **Simulate Requester Agent** to see a second AI generate its own purchase request — true agent-to-agent commerce.


## Screenshots

**Successful order with real-time budget tracking**
![Checkout success](screenshots/demo-checkout.png)

**Budget gate blocking an over-limit order, with graceful reasoning**
![Blocked order](screenshots/demo-blocked.png)

**Monthly ledger — full audit trail at a glance**
![Monthly ledger](screenshots/demo-ledger.png)

**Agent-to-agent commerce: a requester agent generates its own purchase request**
![Agent to agent](screenshots/demo-agent-to-agent.png)

---
Built for the Razorpay AI Buildathon, Track 1.