🎙️ Market Buddy: Autonomous Wholesale Voice Coordination Agent

"An inventory database record is just numbers on a screen. A phone conversation with the warehouse supervisor is a commercial commitment."

Market Buddy is an autonomous wholesale voice coordination agent powered by CALL-E. It bridges the gap between distributors and suppliers by autonomously placing real phone calls, negotiating stock availability, pricing, and dispatch windows, and turning spoken commitments into structured, closed-loop order updates without requiring manual transcription.


💡 Inspiration

Wholesale supply chains move billions of dollars every single day over the telephone. When an urgent order arrives for a hospital, pharmacy, or retailer:

  • Database records lag: ERPs frequently show 200 cases in stock when 80 are already allocated or damaged.
  • Emails get buried: Suppliers take 4 to 8 hours to answer an email—by then, the morning delivery truck has already left.
  • Manual dispatch calling is slow and exhausting: Operations coordinators spend 3 to 4 hours every morning dialling suppliers, chasing dispatch notes, and scribbling quantities on paper.

We asked: What if an AI agent could pick up the phone, speak directly to the wholesale dispatch lead, negotiate partial shipments, and automatically update the purchase order with verified commitment data?

That vision led to Market Buddy.


🚀 What It Does

When an order, low-stock alert, or inventory exception enters the system:

  1. Intelligent Contact Selection: Market Buddy scans the consented supplier roster, picks the primary contact, verifies regional working hours (09:00–19:00 IST), and ensures the contact isn't in cooldown.
  2. Autonomous CALL-E Voice Telephony: The agent places a live phone call via the @call-e/calle SDK with a dynamically tailored task prompt containing order reference, product SKU, and urgency.
  3. Real-Time Voice Negotiation:
    • The Hero Scenario (Partial Stock): For an urgent 200-case order where only 120 are ready today, Market Buddy secures the 120 for today's 2 PM dispatch, negotiates delivery of the remaining 80 for tomorrow at 9 AM, and schedules an automated callback.
    • Commercial Guardrails: If a supplier quotes an inflated price, the agent politely refuses autonomous acceptance and holds the order for human operator approval.
  4. Structured Schema Extraction: CALL-E extracts verified, typed fields (confirmed_quantity, remaining_quantity, dispatch_date, confidence_score, and exact spoken quotes).
  5. Closed-Loop Order Sync: Updates the order status (PARTIALLY_CONFIRMED), books follow-up timers, and streams live waveforms and dual-party transcripts over Server-Sent Events (SSE) to the operations dashboard.

🛠️ How We Built It

Market Buddy is built as an event-driven monorepo:

  • Telephony & Speech Layer: CALL-E (@call-e/calle SDK) using calle.calls.createAndWait(), structured JSON schema extraction, and the plan_call MCP tool for offline prompt rehearsal.
  • Agentic State Machine: LangGraph (@langchain/langgraph) multi-node state graph orchestrating order assessment, contact selection, call planning, SDK execution, and defensive decisioning.
  • Operations Dashboard: Next.js 16 (Turbopack), React 19, Tailwind CSS, and Framer Motion for a live call theatre, audio visualizer, and order simulator.
  • Shared Type System: TypeScript 5.4 monorepo (packages/types, packages/calle, packages/agent, apps/web).
  • Test Architecture: Jest with 19 test suites and 421 tests (100% passing) covering unit, integration, and 14 telephone failure modes (F1–F14).

🧗 Challenges We Faced

  1. Extracting Nuanced Spoken Commitments: Spoken English in wholesale negotiations is colloquial ("I can do a hundred twenty right now and the rest first thing tomorrow morning"). We had to carefully engineer the CALL-E task prompt and wholesaleResultSchema to extract numbers, dates, and conditions with high confidence.
  2. Handling Telephone Edge Cases (F1–F14): We built explicit handlers for no-answers, voicemail detection, line drops, wrong persons answering, ambiguous replies, and supplier price raises.
  3. Safety & Compliance: Ensuring strict compliance with ethical calling practices: the agent always identifies itself as an automated line, never calls outside business hours, respects contact cooldowns, and features a single-click global kill switch.

🏆 Accomplishments That We're Proud Of

  • True Runtime CALL-E Execution: CALL-E is imported and actively executed at runtime via the official SDK—never faked or bypassed.
  • Zero-Transcription Closed Loop: Going from an inbound urgent order to a completed phone call, partial-stock split, and updated order record without human intervention.
  • Rock-Solid Reliability: 421 out of 421 tests passing across 19 suites with zero test failures.
  • Enterprise Safety by Design: Quiet hours enforcement (09:00–19:00 IST), consented roster validation, and live operator price-override approval.

📚 What We Learned

  • Deterministic Boundaries for Voice AI: While LLMs excel at conversational empathy and natural voice interaction, commercial commitments require strict schemas, confidence thresholds ($\ge 0.70$), and deterministic state graphs to prevent hallucinations.
  • Latency Matters: Low audio latency and immediate conversational grounding make voice AI feel natural to busy warehouse personnel.

🔮 What's Next for Market Buddy

  • Regional Multilingual Models: Supporting Hindi, Marathi, Gujarati, and Tamil for local wholesale agricultural and pharmaceutical markets.
  • ERP Connectors: Direct two-way sync integrations with SAP S/4HANA, Microsoft Dynamics 365, and Zoho Inventory.
  • Multi-Channel Confirmation: Automatically generating and sending a signed digital PO via WhatsApp or SMS immediately following a confirmed phone commitment.

Built With

Share this project:

Updates

Submission history