Skip to content

About

autonomous AI procurement agent that uses PayWithLocus wrapped APIs to buy digital services (CoinGecko, Tavily, image gen, etc.) while enforcing user policies and showing real USDC receipts.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

8 Commits

Folders and files

Repository files navigation

ProcureBot πŸ€–πŸ’Έ

Live Demo Video Demo

ProcureBot Logo

The first AI agent that autonomously buys what it needs β€” paying with real USDC.

Built for the Locus Paygentic Hackathon, ProcureBot demonstrates the future of machine-to-machine payments. Ask it anything in natural language; it routes to the best API provider, authorizes a micro-USDC payment via the Locus Machine Payments Protocol, and delivers the result β€” all in seconds.


✨ What it does

ProcureBot lets a simple text prompt trigger a full AI procurement cycle:

"Get the current Solana price"
  β†’ Groq LLM routes to CoinGecko
  β†’ $0.01 USDC authorized & paid via Locus
  β†’ Live price data rendered in chat
  β†’ Receipt logged with txHash

No manual API key management. No manual payments. One wallet, your rules.


πŸ–₯️ App Pages

Route Page
/ Landing Page β€” animated particle background, feature grid, CTA
/dashboard 3-column procurement dashboard β€” Policy Panel Β· Chat Β· Receipt Feed

πŸ—οΈ Architecture

User prompt
    β”‚
    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Groq LLM Router             β”‚  ← llama-3.3-70b-versatile
β”‚  "Which tool should I use?"  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
       β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
       β”‚  Tool Selected  β”‚
       β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Locus Machine Payments Protocol             β”‚
β”‚   callWrappedEndpoint(provider, endpoint, {}) β”‚
β”‚   β†’ USDC micro-payment authorized             β”‚
β”‚   β†’ API call executed                         β”‚
β”‚   β†’ txHash returned                           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
       β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
       β”‚  Formatted      β”‚
       β”‚  Response +     β”‚
       β”‚  Receipt        β”‚
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”Œ Supported Providers

Provider What it does Est. Cost
CoinGecko Live crypto prices, market data, trending coins $0.005–0.01
Tavily Real-time web research & news search $0.01
OpenAI DALLΒ·E Image generation from prompts (rendered inline) $0.025
OpenAI Chat GPT-4o-mini for analysis & writing $0.01
Groq Llama 3.3 for routing + fast answers Free
Replicate Open source image/media models $0.01+
Perplexity AI-powered web search $0.01

⚑ Quick Start

1. Clone & install

git clone https://github.com/NeelShah1505/ProcureBot.git
cd ProcureBot/procurebot
npm install

2. Configure environment

cp .env.example .env.local

Edit .env.local:

# Required β€” get at https://beta.paywithlocus.com
LOCUS_API_KEY=claw_dev_YOUR_KEY_HERE

# Required for AI routing
GROQ_API_KEY=gsk_YOUR_GROQ_KEY

# Required for image generation
OPENAI_API_KEY=sk-YOUR_OPENAI_KEY

# Required for web research
TAVILY_API_KEY=tvly-YOUR_TAVILY_KEY

3. Run

npm run dev

Open http://localhost:3000 πŸš€


πŸ”‘ Getting API Keys

Key Where Free tier?
LOCUS_API_KEY beta.paywithlocus.com Yes β€” hackathon credits
GROQ_API_KEY console.groq.com Yes
OPENAI_API_KEY platform.openai.com Paid
TAVILY_API_KEY tavily.com Yes β€” 1000 free/mo

Fund your Locus wallet: After creating your account, send USDC on Base to your agent wallet address. The balance reflects live in the dashboard left panel.


πŸ§ͺ Demo Walkthrough

Step 1 β€” Landing Page

Visit localhost:3000. Scroll through the marketing page (animated particle background). Click "Try ProcureBot β†’".

Step 2 β€” Verify connection

Top-right pill shows: ✦ Agent Connected Β· 4.374 USDC βœ…

Step 3 β€” Try a crypto price query

Click "SOL Price" card or type:

Get the current Solana price with 24h analysis

Watch the live thinking steps:

  • 🧠 Groq selected: coingecko_price β€” real-time market data needed
  • πŸ’³ Requesting $0.01 USDC spend authorization…
  • 🌐 Calling CoinGecko API…
  • βœ… Success β€” formatting results…
  • πŸ’Έ Paid $0.01 USDC

Step 4 β€” Verify the receipt

Right panel: Session Spend +$0.01 Β· receipt card shows provider, endpoint, cost & timestamp.

Step 5 β€” Generate an image

Click "Gen Image" or type:

Generate an image of a futuristic robot paying with crypto on the blockchain

The actual rendered image appears inline in the chat bubble β€” not just a link.

Step 6 β€” Edit spending policies

In the left panel, click any policy value (e.g. $0.50 USDC next to Max/tx). An inline editor appears. Change it, press Enter to save or Escape to cancel.

Step 7 β€” Research query

Click "Research AI" or type:

What is the latest news about AI agents this week?

Tavily performs live web research and returns a structured summary with source links.


πŸ“ Project Structure

procurebot/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ page.tsx                 # Landing page (scrollable)
β”‚   β”œβ”€β”€ dashboard/page.tsx       # 3-column dashboard (viewport-locked)
β”‚   β”œβ”€β”€ layout.tsx               # Root layout + Google Fonts
β”‚   β”œβ”€β”€ globals.css              # Design tokens, animations, scrollbar
β”‚   └── api/procure/route.ts     # Core procurement API route
β”‚       β”œβ”€β”€ routeWithGroq()      # LLM-powered tool selection
β”‚       β”œβ”€β”€ ruleBasedRoute()     # Fallback regex router
β”‚       └── fmtPrice/fmtImage/fmtTavily… formatters
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ProcureChat.tsx          # Chat UI, markdown renderer, image handler
β”‚   β”œβ”€β”€ PolicyPanel.tsx          # Left sidebar with inline-editable policies
β”‚   β”œβ”€β”€ ReceiptCard.tsx          # Transaction receipt feed
β”‚   β”œβ”€β”€ LocusConnect.tsx         # Live connection + balance pill
β”‚   └── ui/
β”‚       β”œβ”€β”€ AnimatedBackground.tsx   # Canvas: particles + glowing orbs
β”‚       β”œβ”€β”€ GlowCard.tsx
β”‚       └── index.tsx
└── lib/
    └── locus.ts                 # Locus SDK: getBalance, callWrappedEndpoint, groqChat

πŸ” Spending Controls

All spending is governed by policies enforced by the Locus platform:

Policy Default Description
Max per tx $0.50 USDC Hard cap per single API call
Daily cap $15.00 USDC Maximum total spend per day
Auto-approve < $0.10 USDC Instant transactions under threshold
Providers 6 enabled CoinGecko, Tavily, OpenAI, Groq, Perplexity, Replicate

Transactions above the auto-approve threshold return an approvalUrl β€” a manual confirmation link shown directly in the chat.


πŸ› οΈ Tech Stack

Layer Tech
Framework Next.js 16.2.3 (Turbopack)
Language TypeScript
Styling Vanilla CSS + Tailwind v4
Animations CSS keyframes + HTML Canvas API
AI Routing Groq β€” llama-3.3-70b-versatile
Payments Locus Machine Payments Protocol (USDC on Base)
Icons Lucide React

🌐 How Locus Works

The Locus Machine Payments Protocol wraps external APIs with an on-chain payment layer on Base (Ethereum L2). When ProcureBot calls:

await callWrappedEndpoint("coingecko", "simple-price", { ids: "solana", vs_currencies: "usd" })
  1. Locus checks your agent wallet's USDC balance on Base
  2. If sufficient and within policy β†’ spend is authorized
  3. The wrapped API call executes server-side
  4. A txHash and cost are returned alongside the data
  5. Your balance decreases by the exact fractional USDC cost

Every purchase is transparent, on-chain verifiable, and policy-governed.


πŸ† Built For

Locus Paygentic Hackathon β€” Showcasing the power of machine-initiated micro-payments for AI agents.

"What if AI agents could pay for what they need, when they need it β€” just like a human with a credit card, but fully autonomous and on-chain?"


ProcureBot · Built with ❀️ on Locus

About

autonomous AI procurement agent that uses PayWithLocus wrapped APIs to buy digital services (CoinGecko, Tavily, image gen, etc.) while enforcing user policies and showing real USDC receipts.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages