This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle
What I Built
Hey devs! I have built Aegis - An agentic commerce infrastructure
As we all know in this era where everything is shifting towards automation e-commerce is also moving towards agentic commerce where the traditional methods do not work now. An ai agent buys on your behalf. Aegis is build around this whole thing.
What Aegis is?
It is an agentic dashboard which manages AI buyer with stock updates , geo optimized payload generation to attract AI buyers , Payment verification , orders , DB lookup and everything you need to do as a merchant dealing with AI buyer.
But wait,
1. What happens if an agent is malicious coming for the first time will you trust it without checking :-
-> Answer is No, Aegis may handle everything but it isn't the main authority. The main authority stays with the merchant.Every new bot when makes it first order it is shown at merchant dashboard with all the details of bot and it's purchase request it is on the merchant's hand to approve it or not after verification. Once approved order is made and that agent is flagged as trusted so when it comes the next time it doesn't have to wait for verification.
2. Good, but what if two bots are buying same stock that will be an issue :-
-> No, Aegis have got row locking in it's node backend with a TTL(Time to Live) of 5 minutes a row is locked once order is approved, so no other buyer can buy the same stock if payment isn't confirmed withing 5 minutes the row lock is rolled back.
3. Who manages all this payment request, purchase intent, asking for payload and all.
-> This part is governed by my deterministic LangGraph agent using already made schema.sql in ai-service it asks for exact needed details from buyers , with the nodes of the agent defined for each task it easily handles everything while you sit sipping tea.
4. What if someone asks for the order with quantity of an item more than stock.
-> In that case the order is cancelled by the agent itself with a payload of error given to the bot.
5. What if many buyers comes at once it will fail right.
-> Sorry, it won't because whole Aegis ai-service is written using asyncio and db communications are made using asyncpg (meaning all process are asynchronous), with lazy-loaded singleton db connection pool implemented there is no chance of cross db connection and memory leaks. Also, since it is a polyglot microservice all the payments are always safe as the agent never communicates to db directly. Every thing is taken care of between them using idempitency keys to ensure verification
Not only that Aegis gives you features of DB lookup to look at the updated stocks and ledger entries to keep track of everything. Since, it uses postgreSql it is very easy to update new stocks. It is containarized with docker and ready to use with kubernetes with already written manifests in repo.
Note:-
Aegis is made using langchain and langgraph so, there is no problem in changing the AI model you can adjust it to your prefrence like:- Gemma,Gemini,Mistral,Claude etc. anything you want just replace the names and change .env that's it. Right now it uses mistral-7b-instruct and nomic-based-text embedding model all managed through Ollama.
Hope i didn't bored you.🥸
There's still much left scroll downwards.
Demo
Note:- In the video at around 06:00 minutes there is something which seems to be a small mistake, in command 1b i missed pasting the razorpay_order_id in the curl command leading to pending status and rollback after 5 minutes. But, that part was intentionally missed to show the rollback at the end and the ssh key part is for the payment gateway webhook once it is deployed i haven't used it here cuz it is paid and also for testmode api there are limited features available to you. Although the code is totally functional. Hope you all Understand.
Code
Check out the full repository on GitHub: Aegis Agentic Commerce Dashboard
How I Built It
I built Aegis around a local open-source stack using Ollama to run mistral-7b-instruct for intent parsing and nomic-embed-text for semantic operations. I chose local inference to cut out external API costs and latency, but since everything is hooked together using LangChain and LangGraph, the setup is model-agnostic-swapping to Gemma, Gemini, or Claude just takes a line change in the .env.
The core project is structured around a deterministic LangGraph workflow mapped straight to our PostgreSQL schema.sql. Instead of letting an LLM run wild with tools, each transaction step (ingesting payloads, checking stocks, and formatting responses) happens in controlled nodes. If an AI buyer asks for more quantity than is in stock, the agent immediately rejects the request with an error payload without ever touching payments.
To keep it secure, the agent never talks directly to the database. Aegis runs as a polyglot microservice: the AI service is built in Python using asyncio and asyncpg with a lazy-loaded singleton connection pool to handle concurrency without memory leaks. Orders, payments, and row locking (with a 5-minute TTL to prevent two bots fighting over the same item) are handled via Node.js, and everything syncs safely using idempotency keys. The whole project is wrapped in Docker containers with ready-to-run Kubernetes manifests for deployment.
Why Does Open Innovation Matter?
When you are building commerce infrastructure, especially for an automated buyer ecosystem, trusting a black-box closed API with mission-critical business transactions simply doesn't cut it. Open innovation matters here because handling automated checkout, stock verification, and ledger updates requires total predictability, zero external latency bottlenecks, and real privacy.
Closed APIs introduce unpredictability that breaks automated checkout flows. Model providers constantly push silent updates, deprecations, or subtle behavior shifts under the hood. In a consumer chatbot that might cause a quirky response, but in an agentic commerce pipeline, a slightly drifted JSON format or unexpected hallucinated field can corrupt an order payload, trigger race conditions, or fail a payment handshake. Running open-weight models locally with Ollama and chaining them through open-source orchestration like LangGraph means our transaction schemas, validation checks, and node boundaries are 100% deterministic and under our control.
Latency and reliability are also make-or-break when bots are transacting. When two AI buyer agents are attempting to check out inventory with a live 5-minute row lock, you cannot afford random API rate limits, provider downtime, or unpredictable queue times over the internet. Local open inference guarantees consistent response times on every request without relying on a third-party server's health status.
Then there is cost and data privacy. High-frequency bot traffic-checking inventory, negotiating payloads, and verifying intents-quickly racks up massive metered token bills on proprietary APIs. With open models, that marginal inference cost drops to zero. More importantly, merchant stock data, internal schema structures, and transaction records stay strictly within our own infrastructure boundary. Closed APIs demand sending every buyer detail and payload to third-party servers; open innovation let us containerize the entire pipeline-from the database to the inference engine-inside Docker and deploy it securely anywhere via Kubernetes.
If you liked it please star the repo, like the post and the video. Keep building! Keep exploring!😁
Top comments (0)