AUTONOMIQ
Inspiration
Small shop owners make dozens of decisions a week: what to reorder, who to buy from, what to charge. Most business software only shows charts and leaves every decision to the owner. I wanted software that acts on the numbers, with the owner approving only the moves that involve money. The PayPal AI Hackathon theme of agentic commerce fit that idea, so I built a team of AI agents that notice a problem, negotiate a fix, and hand the owner a ready-to-pay deal.
How I built it
The backend is FastAPI with SQLAlchemy. Nine agents are coordinated by a LangGraph orchestrator that turns a plain-language command into a workflow. The frontend is React + Vite with Tailwind and AG Grid, and payments use the PayPal Orders API v2 and webhooks.
Each agent has a narrow job, and the numbers are never left to an LLM:
• Margin guardrail. With retail price $P$ and minimum margin $m$, the most the Buyer Agent may pay is
$$p_{\max} = P\,(1-m),$$
so selling at $P = 79.99$ with $m = 0.25$ gives a ceiling of $59.99$. • Negotiation. Over $T = 6$ rounds, the buyer concedes slowly toward its ceiling $c$ from an opening offer $b_0$, and the seller concedes toward its private floor $f$ from its list price $\ell$:
$$B(t) = b_0 + (c - b_0)\left(\tfrac{t}{T}\right)^{1.8}, \qquad S(t) = \ell - (\ell - f)\,\tfrac{t}{T}.$$
A side accepts once the other's price meets its own planned price for that round, so the final price lands between the two curves. In my test run, three suppliers settled between about $57 and $58 per unit, inside the ceiling. • Forecasting. Demand comes from a Ridge regression on a trend plus day-of-week effects, checked against a 14-day holdout:
$$\hat{y}t = \beta_0 + \beta_1 t + \sum{d=0}^{6}\gamma_d\,\mathbb{1}[\text{dow}(t)=d].$$
• Digital twin. A price change $\Delta p$ shifts demand by $D' = D\,(1+\Delta p)^{\varepsilon}$ with elasticity $\varepsilon = -1.4$. The twin then replays 30 days of sales against stock.
• Choosing a supplier. Each agreed deal gets a score from margin headroom $h$, reliability $r$, delivery speed $d$ and stock coverage $s$:
$$\text{score} = 0.50\,h + 0.25\,r + 0.15\,d + 0.10\,s.$$
Challenges
• Keeping an LLM from breaking limits. Letting a model pick prices risked offers below a seller's floor or above the margin limit. I moved all prices into bounded strategies and limited the LLM to writing the messages. The app still works with no API key.
• Double-counting payments. A PayPal capture response and its webhook can both arrive for the same payment. I made settlement idempotent, so stock and cash balances change exactly once.
• Testing without credentials. I built a simulated checkout that runs the same order, capture, webhook-record, settlement and refund paths, then covered that flow with an end-to-end test.
• Keeping seller secrets private. The listings API strips floor prices, and a test checks that they never reach buyers.
What I learned
• Multi-agent systems work best when each agent is narrow and the risky parts, like money and limits, stay in deterministic code.
• Explainability is mostly a data-design choice. Logging every offer and its reasoning gave me the decision trail and the negotiation replay almost for free.
• Payment integrations need idempotency from the start.
Built With
- ag-grid
- fastapi
- gemini-api
- javascript
- langgraph
- numpy
- openai-api
- paypal-js-sdk
- paypal-orders-api
- paypal-sandbox
- paypal-webhooks
- postgresql
- postman
- pydantic
- python
- react
- recharts
- render
- scikit-learn
- sqlalchemy
- sqlite
- supabase
- tailwindcss
- vite