Inspiration
B2B procurement is broken. Buyers spend days comparing vendors, writing RFQs, and negotiating over email — with zero visibility into whether they got a fair deal. We wanted to prove that a multi-agent AI system could compress that entire process into seconds, with every decision explainable and every constraint enforced deterministically.
What It Does
Pactum turns a free-text procurement request into a negotiated, audited deal recommendation — with one human approval gate at the end.
- Requirement extraction — Gemini 2.5 Flash parses the buyer's message into structured specs: budget, delivery window, warranty, power limits, dimensions.
- Product clustering — deterministic Euclidean distance matches needs across 7 vendor inventories.
- Parallel judging — a Judging Agent explains in plain English why each candidate is a good fit, borderline, or bad.
- Live negotiation — 3 ranked suppliers negotiate concurrently. Every turn streams to the UI in real time. A hard 10% seller price floor is enforced in Python — no LLM can override it.
- Deterministic validation — price, delivery, warranty, size, and power constraints are checked in code, not by a model.
- One human checkpoint — the buyer approves, rejects, or renegotiates. That's the only pause.
- Audit + deal card — Gemini writes a narrative summary; fal generates a visual deal card.
How We Built It
Buyer prompt
→ Gemini 2.5 Flash (requirement extraction)
→ Euclidean clustering (product matching)
→ ThreadPoolExecutor (parallel judging)
→ 3× Negotiation threads (live SSE streaming)
→ Pioneer (message labeling + offer field extraction)
→ Deterministic Python (hard constraint validation)
→ [Human approval gate]
→ Gemini audit + fal deal card
The backend is FastAPI streaming Server-Sent Events to a Next.js 15 frontend. Agent activity appears line-by-line in real time — no pre-written dialogue, every LLM call happens live. Supabase Realtime powers the seller dashboard, which updates the moment a deal session completes.
The core design rule: deterministic Python owns every pass/fail decision. Gemini owns language. No LLM can override a hard constraint check.
Challenges
- Streaming parallel negotiations — three supplier threads feeding a shared queue, drained and yielded with pacing delays to feel like real conversations, while keeping SSE ordering consistent.
- Keeping LLMs honest — ensuring Gemini never leaks into validation logic. Every offer field (price, delivery, warranty) is extracted by Pioneer and checked by Python, not inferred by a model.
- Fallback chains — every external API (Gemini, Pioneer, Tavily, fal) has a timeout, a retry, and a structured fallback so the demo never crashes mid-presentation.
- One clean HITL moment — collapsing all the "should we proceed?" decisions into a single human approval gate without making the flow feel abrupt.
Accomplishments
- Full agent pipeline — extract → cluster → judge → negotiate → validate → approve → audit — runs end-to-end in under 30 seconds.
- Negotiation turns stream live, supplier-by-supplier, with Pioneer labeling each message in real time.
- The 10% seller floor waterfall works: aggressive strategy crosses the floor, gets rejected deterministically, and the system rolls over to the next supplier automatically.
- Zero silent failures — every timeout, rejection, and fallback surfaces in the agent feed with a natural-language explanation.
What We Learned
- Multi-agent systems need hard seams between probabilistic and deterministic logic — blurring that line is where demos fall apart.
- SSE is underrated for agentic UIs. It's simpler than WebSockets and forces a clean event contract.
- Fallback design is the real engineering work. The happy path is easy; what keeps a live demo alive is every
exceptblock.
Built With
Next.js 15, FastAPI, Python, Gemini 2.5 Flash, Pioneer, Tavily, fal, Supabase Realtime, Server-Sent Events, ThreadPoolExecutor, BM25, Euclidean clustering, Railway, Vercel
Built With
- bm25
- euclidean-clustering
- fal
- fastapi
- gemini-2.5-flash
- next.js-15
- pioneer
- python
- railway
- server-sent-events-(sse)
- supabase-realtime
- tavily
- threadpoolexecutor
- vercel
Log in or sign up for Devpost to join the conversation.