Inspiration

Retail inventory decisions are made too late. Sales change every minute, stock is scattered across stores, and operators rely on spreadsheets. Stockouts lose revenue, overstock burns cash, and alert fatigue slows response.

We built SmartStock AI to apply AI to data in motion—streaming sales activity through Confluent Kafka, analyzing it with Gemini AI in real time, and driving automated actions before problems become losses.

What it does

SmartStock AI is an autonomous inventory intelligence platform that:

  • Streams sales events through Confluent Kafka in real time
  • Predicts demand and identifies products at risk of stockout using Gemini AI
  • Generates restock recommendations with quantity and timing
  • Suggests multi-store transfers to rebalance inventory across locations
  • Lets operators auto-resolve alerts with AI reasoning and confidence scores
  • Creates purchase orders and emails suppliers with a single "Place Order" action
  • Maintains a full audit trail of every decision and purchase order event

How we built it

Real-Time Streaming (Confluent)

  • Confluent Kafka is the event backbone. Topics include: sales-transactions, inventory-updates, demand-predictions, restock-alerts, and purchase_order_events.
  • Two BigQuery Sink Connectors ingest data from Kafka into BigQuery:
    • One for high-volume sales-transactions
    • One for operational topics (inventory, predictions, alerts, purchase orders)
  • The backend consumes sales-transactions in real time to trigger inventory updates and alerts.

AI on Data in Motion (Google Cloud)

  • A multi-agent ADK pipeline runs periodically via Cloud Scheduler.
  • Agents: SalesDataFetcher, MarketIntelAgent, InventoryAnalyzer, DemandPredictor, RecommendationValidator, ActionPublisher.
  • Gemini 2.0 Flash (Vertex AI) powers all reasoning—demand prediction, alert resolution, transfer optimization.
  • AI decisions include confidence scores and reasoning so operators can trust and verify.

Kafka-First Purchase Orders

  • Purchase orders are modeled as event streams on purchase_order_events.
  • Events are materialized into BigQuery for current-state views and full audit trails.
  • On approval, the system sends a supplier email and records the result as an event—fully auditable procurement.

Frontend

  • React 18 + Vite + Tailwind CSS for a fast, responsive UI.
  • Recharts for analytics visualizations.
  • Instant UI feedback: placing orders, confirming transfers, and resolving alerts update the interface immediately.

Challenges we ran into

  • Aligning Kafka event schemas with BigQuery Sink Connector expectations (especially nested fields and timestamps).
  • Achieving instant UI responsiveness after backend actions.
  • Designing a demo-friendly setup that's still production-grade: event sourcing, auditability, and separation of write/read paths.

Accomplishments we're proud of

  • A working end-to-end loop: stream → warehouse → AI → action → audit.
  • AI on data in motion: Gemini decisions are triggered by live Kafka streams, not batch jobs.
  • A single "Place Order" action that creates the PO, sends supplier email, and updates the UI—all in one click.
  • A multi-agent ADK pipeline that orchestrates five specialized agents for inventory intelligence.
  • Full auditability: every event (sales, predictions, orders) flows through Kafka and lands in BigQuery.

What we learned

  • Real-time data makes AI decisions actionable—batch analytics are too slow for inventory ops.
  • Event-driven systems are easier to trust when every action is auditable.
  • AI features land better when the UX is instant and explainable (confidence + reasoning).
  • BigQuery + Kafka Connect is a powerful combo for analytics layers fed by reliable streaming.

What's next

  • Role-based approval workflows for procurement.
  • Anomaly detection for fraud, demand spikes, and promotions.
  • Cost-aware transfer optimization and supplier lead-time modeling.
  • Mobile-friendly dashboard for store managers.

Built With

  • bigquery
  • confluent-kafka
  • express.js
  • fastapi
  • gemini-2.0-flash
  • gmailapi
  • google-adk
  • google-cloud-run
  • kafka-connect
  • kafkajs
  • lucide-react
  • node.js
  • python
  • react
  • recharts
  • tailwind-css
  • vertex-ai
  • vite
Share this project:

Updates