Inspiration

Imagine your company just landed a massive, nine-figure deal. The catch? You need to start fulfilling it tomorrow. Normally, the celebration stops dead right there. Your procurement team now faces an 8-hour nightmare of manually scraping arbitrary B2B sites, comparing prices, checking minimum order quantities, and guessing if they got the best deal.

I built Leviathan to fix this. Sourcing parts shouldn't kill your momentum or your deal. I wanted to build an agentic workflow that reduces that manual slog down to just a couple of minutes, giving founders and procurement officers their time, and their profit margins, back.

What it does

Leviathan is a B2B SaaS tool that automates supply chain sourcing. You just type what you need into the UI (say, "100,000 steel ball bearings") and deploy the swarm.

It takes that prompt, fires up a browser agent, and autonomously searches vendor hubs like Alibaba. It visually parses the search results, extracts the top suppliers, their price bounds, and minimum order quantities (MOQs), and reasons through the best options. Once it has the data, Leviathan automatically synthesizes it into a formal Letter of Intent (LOI).

Instead of jumping between tabs, you review the drafted LOI right in the dashboard. With one click, you can email it directly to the supplier to start negotiations.

How we built it

Leviathan is built on a split-stack architecture to keep the frontend snappy and the backend heavy-lifting isolated.

  • The Frontend: We used Next.js 16 (App Router) and React 19, styled with Tailwind CSS 4. The core visual experience, the interactive swarm canvas, is built using @xyflow/react and animated with Framer Motion. State management for the session and generated LOI is handled by Zustand.
  • The Backend & AI: The orchestration layer is a Python FastAPI server. The AI pipeline is a pragmatic, two-stage process using gpt-4o. First, we used the browser-use library to spin up a headless browser. The agent physically navigates to Alibaba search results and extracts supplier cards. We hard-capped the agent to 10 steps so it stays focused. Second, a LangChain-wrapped gpt-4o pass takes that unstructured data and drafts the structured LOI.
  • The Infrastructure: The FastAPI server streams execution logs back to the Next.js client via Server-Sent Events (SSE), giving users a real-time window into the agent's actions. Finally, a Next.js route handler uses nodemailer over SMTP to fire off the email right from the UI.

Challenges we ran into

Taming the browser automation was the biggest hurdle. LLMs driving browsers tend to wander off. If you let an agent loose on a vendor site without strict guardrails, it will try to click into every single product page, get lost, and time out. We had to heavily constrain the prompt and cap the execution steps to force the agent to only scan the top-level search results.

Also, marrying the real-time Python backend execution with a smooth React frontend UI took some finessing. We had to build a custom logging handler to stream SSEs to the frontend so that the UI could dynamically change states (from SCRAPING to NEGOTIATING) based on heuristic log keywords.

Accomplishments that we're proud of

It actually works end-to-end, and it’s incredibly fast. Going from a raw text prompt to a fully researched, generated LOI sitting in a vendor's inbox in under 3 minutes is a massive win. I'm also really proud of how the UI feels. The React Flow canvas paired with the live SSE logs gives the user total transparency into the AI's "thought process." It doesn't feel like a black box.

What we learned

We learned that you don't always need an overly complex, distributed multi-agent framework to get "swarm-like" results. A well-orchestrated, two-stage LLM pipeline, where one agent physically gathers data via a browser and another reasons over it, is significantly faster, cheaper, and less prone to infinite loops.

What's next for Leviathan

Right now, the "swarm" is a powerful UI metaphor for our 2-stage pipeline. The immediate next step is breaking the backend out into true distributed, concurrent agents (a dedicated scout, a dedicated negotiator, a compliance verifier). We also plan to introduce a persistence layer (like Postgres) so Leviathan can remember vendor histories, track defect rates over time, and learn which suppliers negotiate best.

Built With

  • browser-use
  • fastapi
  • framernotion
  • langchain
  • next.js
  • nodemailer
  • openai
  • pydantic
  • python
  • react
  • reactflow
  • sse
  • tailwindcss
  • uvicorn
  • zustand
Share this project:

Updates