Inspiration

Real estate investment analysis is traditionally asymmetrical institutional investors have armies of analysts and proprietary quantitative models, while retail investors rely on gut feelings, spreadsheets, and fragmented searches. We wanted to democratize institutional-grade research by building an autonomous AI system that acts exactly like an elite investment firm. We were inspired by the concept of "agentic swarms" and cloud-edge synergy. What if your prompt could instantly deploy a massive multi-agent AI framework on high-performance GPUs, while simultaneously utilizing bleeding-edge serverless technology for lightning-fast delivery to the user?

What it does

EstateAgent AI is an autonomous, multi-agent real estate intelligence system that translates a natural language prompt (e.g., "Where should I invest $500k in Southern Illinois?") into a mathematically rigorous investment memo.

It achieves this through a 3-tier Map-Reduce architecture:

  1. The Architect (Planner): Extracts budget, goals, risk tolerance, and time horizon from the user's prompt to map out a distributed task schema.
  2. The Swarm (Analysts & Simulation): Spawns parallel Regional Analyst agents that gather datasets (such as demographics, foot traffic, and competitors). To calculate financial viability, it utilizes a heavy-compute Simulation Agent that spins up 100 parallel containers to run 5,000 Monte Carlo financial scenarios concurrently in under 12 seconds, calculating probabilistic outcomes for Return on Investment (ROI).
  3. The Advisor (Conclusion): Synthesizes the swarm's fragmented metrics into a cohesive advisory memo, scoring risks, calculating feasibility, and delivering an actionable verdict.

How we built it

We engineered a highly resilient, distributed system that splits heavy AI/Compute processing from Edge API delivery.

  • Heavy Backend (Modal): The core intelligence runs on Modal's serverless infrastructure. This allows us to instantly spin up hundreds of transient containers for the heavy Monte Carlo simulations. The reasoning layer relies on Qwen 2.5 (7B-Instruct) running via the vLLM engine.
  • Safe Autonomous Code Execution: We built a custom execution engine (sandbox/executor.py) utilizing gVisor. This allows our AI agents to write, execute, and read the outputs of arbitrary Python financial modeling scripts without risking infrastructure security.
  • The Global Edge (Cloudflare Developer Platform): To make the frontend highly responsive, we leaned heavily into the Cloudflare ecosystem, utilizing 7 distinct primitives:
    • Workers & Durable Objects: Acts as our edge API gateway and manages stateful WebSocket connections to stream real-time pipeline progress to the React frontend.
    • Workers AI: Provides edge-level inference (Llama 3.1 8B) for fast fallback LLM calls, semantic search, and prompt classification.
    • KV, D1, & R2: KV handles sub-millisecond caching and rate-limiting. D1 serves as our SQL analytics database for session history. R2 acts as our durable object storage for full JSON advisory reports.
    • Vectorize: Indexes past analyses using BGE embeddings (768-dim) for lightning-fast semantic similarity search of historical computations.
  • Real-Time Frontend: Built strictly in React 18, TypeScript, and Tailwind CSS (Vite), the UI leverages custom WebHooks and Durable Objects to provide users with a live "Agent Timeline" and a "Simulation Dashboard" that dynamically animates as all 5,000 Monte Carlo pipelines run in parallel.

Challenges we ran into

  • Differentiating "Thinking" from "Math": LLMs are remarkably bad at doing complex financial math intuitively. We had to architect the system so the LLM acts purely as an orchestrator and code-writer. Passing live simulation parameters into Python runtime environments and routing the numeric stdout back to the LLM for synthesis was immensely difficult.
  • Integrating Modal and Cloudflare Seamlessly: Bridging Modal's heavy backend jobs with Cloudflare's edge workers required setting up robust webhooks and distributed queues. Ensuring that an event emitted deep inside a Python Modal container correctly routed up to a Cloudflare Durable Object to tick a frontend React counter via WebSocket took extensive debugging.
  • Managing the "Hallucination Cascade": If Tier 1 (The Planner) hallucinates a bad plan, Tier 2 runs fundamentally flawed simulations, completely ruining Tier 3’s conclusion. We solved this by strictly enforcing rigid JSON schema definitions wrapped in retry-safe parsers across the Map-Reduce pipeline.

Accomplishments that we're proud of

  • True Map-Reduce Agent Swarm: Many "multi-agent" systems are just sequential ChatBots passing text back and forth. Ours genuinely disperses mathematical and dataset-loading tasks horizontally across a distributed cloud network, running thousands of simulations concurrently, and reducing them flawlessly.
  • Full Cloudflare Primitives Integration: Successfully integrating Workers, Durable Objects, KV, D1, R2, Vectorize, and Workers AI into a single cohesive project gave the application a massive performance edge.
  • Edge AI Fallbacks: We implemented a seamless fallback mechanism. If the primary heavy LLM endpoint on Modal cold-starts or fails, the pipeline automatically routes its reasoning requests to Cloudflare Workers AI at the edge to keep operations moving without throwing 500 errors to the user.

What we learned

We learned that Compute + Deterministic Sandbox Execution > Prompt Engineering when doing real-world financial analysis. Forcing models to write real Python to find the math exponentially increases accuracy. Furthermore, we discovered the sheer power of serverless orchestration: by pairing Modal's instant, heavy-container fan-out with Cloudflare's sub-millisecond, globally distributed edge caching and webhooks, you can achieve both massive compute power and flawless UX latency simultaneously.

What's next for EstateAgent AI

  • Live MLS API Integration: Replacing our synthetic data generation by plugging the backend directly into live Multiple Listing Service (MLS) and real-time census API databases.
  • Specialized Expert Agents: Adding new node chains to the Swarm. For example, a Legal Agent that evaluates local zoning laws, or a Tax Agent that optimizes property tax implications and LLC structuring via edge AI RAG retrieval on municipal tax codes.
  • Continuous Monitoring Loop via Cloudflare Cron Triggers: Utilizing Cloudflare Workers' CRON schedules to continually re-evaluate the market and run background simulations, pushing SMS/Email alerts to users when an investment strategy matches current market conditions in real-time.

Built With

  • bash
  • cloudflare-d1
  • cloudflare-kv
  • cloudflare-vectorize
  • cloudflare-workers-ai
  • css
  • fastapi
  • framer-motion
  • html
  • llama-3.1-8b
  • modal
  • python
  • qwen-2.5
  • react-18
  • sql
  • tailwind-css
  • typescript
  • vite
  • vllm
Share this project:

Updates