Inspiration

In the current enterprise landscape, B2B procurement is incredibly inefficient. Purchasing managers and wholesale suppliers spend countless hours trapped in email threads, haggling over bulk pricing, margins, and purchase orders. We wanted to envision a future where autonomous AI agents handle the entire negotiation lifecycle. By assigning specific constraints to a Buyer Agent (budget limits) and a Merchant Agent (margin protection), we realized we could create a system that negotiates a fair Nash Equilibrium and settles the payment instantly, completely removing the human bottleneck.

What it does

PactPay is an autonomous B2B procurement engine. It replaces manual vendor negotiations with a multi-agent AI swarm that argues over real-time wholesale margins on behalf of the user. You simply input what you need to buy, your required volume, and your maximum budget cap. The system's Buyer Agent then initiates a conversation with a Supplier Agent. They haggle over the price, and if they reach a mathematically viable agreement, the system autonomously mints a live, executable transaction using the PayPal Agent Toolkit.

How we built it

We engineered a full-stack, real-time agentic architecture designed for speed and reliability:

  • The AI Brain (Gemini 3.5 Flash-Lite): We utilized Gemini for its ultra-low latency, orchestrating the negotiation loop via LangChain. The models were prompted with strict mathematical constraints so they actively haggle for the best deal rather than immediately agreeing.
  • The Backend (FastAPI & WebSockets): A Python-based event-driven backend handles the multi-agent swarm, streaming their internal reasoning and counter-offers in real-time to the client.
  • The Frontend (Next.js & AG Grid): We designed a modern, minimalistic "Command Center" UI using a custom warm Obsidian and Amber palette. We used Framer Motion for fluid entrance animations and AG Grid with a custom dark-mode theme to render the cryptographic settlement ledger. Sponsor Integrations
  • Channel3 API Sourcing: We simulated a dynamic integration with the Channel3 marketplace catalog. When a user requests an item, the system intercepts the prompt, queries the catalog, and injects official SKUs, MSRPs, and wholesale minimums directly into the AI's context.
  • PayPal Agent Toolkit: Instead of hardcoding the checkout, we bound the native PayPal API directly to the LLM as an executable tool. The Merchant Agent autonomously evaluates the buyer's bid, and if it exceeds the wholesale floor, it triggers the toolkit to mint a real sandbox transaction.

Challenges we ran into

  • Initially, the AI would sometimes hallucinate a deal or accept an offer below its required margin. We had to heavily refine our LangChain tool-binding and system prompts to ensure the Merchant Agent acts ruthlessly to protect its margins, only executing the PayPal tool when the math perfectly aligns.
  • Managing the asynchronous handoffs between two distinct LLM calls over a WebSocket connection required careful state management to prevent race conditions and ensure the UI reflected the exact state of the negotiation round.
  • Our first iteration of the dashboard was cluttered with too much telemetry. We completely overhauled the design to a minimal, high-contrast fintech aesthetic to ensure the focus remained entirely on the live dialogue and the final PayPal settlement link.

Accomplishments that we're proud of

  • We successfully transitioned the project from a scripted chatbot into a true autonomous agent. Watching the AI mathematically evaluate a deal, refuse an offer to protect its margins, and counter-offer without human intervention was a massive win.
  • Successfully decoupling the payment logic and giving the LLM direct, native function-calling access to the PayPal API to autonomously generate a sandbox checkout link.

What we learned

  • We learned how to pit two LLMs against each other in a constrained environment, moving beyond simple single-prompt tools into complex agentic architectures with competing objectives.
  • We gained deep experience in wrapping external REST APIs (like PayPal's checkout) into native LangChain functions that an LLM can invoke based on its own reasoning.
  • We mastered piping live, unstructured LLM outputs into structured, animated frontend components and data grids.

What's next for PactPay

We plan to expand the protocol to support multi-vendor bidding, where one Buyer agent negotiates with three different Supplier agents simultaneously to secure the absolute lowest market rate. We also aim to integrate production PayPal webhooks to automatically generate PDF invoices and trigger real-world logistics and shipping APIs the moment a settlement clears.

Built With

Share this project:

Updates

Submission history