Inspiration

Walking through a mall and noticing one wing completely empty while the other was packed. Property managers know dead zones exist, they just don't have a fast, automated way to act on them. We wanted to build that tool.

What it does

MallAgentPro is a Gemini AI agent that runs a 7-stage pipeline across mall foot-traffic data: it finds dead zones, diagnoses the cause, generates a targeted campaign, and waits for a human to approve before writing anything to production. After each decision, the operator can rerun the analysis for a different time window, morning, evening, weekend, late night — and get a completely new campaign. Every approved campaign is stored in MongoDB Atlas and visible in a live history tab.

How we built it

  • AI orchestration: Gemini on Google Cloud Agent Builder, calling 6 Python tools across the pipeline
  • Backend: Flask on Google Cloud Run, with a /restart endpoint that lets the agent rerun without redeploying
  • Database: MongoDB Atlas via PyMongo, stores every campaign with full approval audit trail
  • Frontend: Vanilla JS with Chart.js, a live mall heatmap, AI typewriter reasoning stream, and confetti on approval

Challenges we ran into

Getting the human-in-the-loop gate right was harder than expected. The agent runs in a background thread and blocks on a threading.Event, restarting it cleanly for a new time window without killing the Flask server required a generation counter pattern. We also had to URL-encode the MongoDB password and restructure Flask startup order before Cloud Run health checks would pass.

Accomplishments that we're proud of

The approval gate is enforced at the tool level, not just the UI. The agent literally cannot call publish_campaign unless campaign["status"] == "APPROVED". No prompt engineering can bypass it. That felt like the right way to build agentic AI.

What we learned

Agentic AI systems need hard constraints, not soft ones. Threading + Flask + a long-running AI loop is trickier than it looks. And MongoDB Atlas is genuinely fast to wire up, the PyMongo integration went from zero to working in under an hour.

What's next for MallAgentPro

Real sensor data (Cisco Meraki API), a floor plan editor where managers draw their own zone boundaries, multi-property support for managing several malls from one account, and live campaign execution through digital signage APIs instead of simulated lift.

Built With

Share this project:

Updates