Inspiration
Cities don't react to events as a single entity. They react through thousands of people, communities, and neighborhoods, each with their own perspectives, priorities, and experiences.
We were inspired by the idea of turning a real city into a living simulation where events ripple through a population and produce emergent behavior. Traditional simulations often focus on infrastructure, economics, or statistics. We wanted to explore the human side of cities: how people collectively respond to celebrations, crises, cultural moments, and unexpected disruptions.
Toronto became our sandbox because of its diversity, distinct neighborhoods, and rich public data. Every district has its own identity, making it the perfect environment to simulate how different communities experience the same event in different ways.
Our launch scenario is the FIFA World Cup 2026, but the larger vision is a platform that can simulate any city-scale event—from elections and festivals to transit disruptions and emergencies.
What it does
AlgoPolis is a living city simulation engine powered by AI agents.
The platform models a city as a collection of districts, each with its own demographics, alignment, emotional state, and activity levels. As events occur, the simulation updates district states in real time and visualizes how reactions spread throughout the city.
Users can inject events directly into the simulation or enable Autopilot mode, where an AI director generates event timelines automatically.
The simulation combines:
- A deterministic city engine that computes how districts react
- AI-powered archetype agents that represent different communities
- Citizen agents that personalize reactions and create believable local narratives
- A live social feed showing how people across the city are responding
- A 3D interactive map that visualizes changes in city sentiment and activity
The result is a city that feels alive, where every event creates visible and measurable consequences.
How we built it
The backend is built with Python, FastAPI, and asyncio.
At the core of the system is an event-driven simulation engine. Events enter a queue and are processed by deterministic rules that update district state. This keeps the simulation stable, explainable, and easy to debug.
Districts maintain information such as:
- Excitement
- Tension
- Frustration
- Pride
- Social activity
- Mobility
We implemented a two-layer agent architecture inspired by large-scale society simulations.
The first layer consists of archetype agents representing broader groups within each district. These agents determine how a community reacts to an event.
The second layer consists of lightweight citizen agents that personalize those reactions into individual behaviors and social posts. This approach allows us to create the feeling of a large population without requiring thousands of expensive AI calls.
MongoDB stores simulation sessions, district states, event histories, and agent data. WebSockets stream updates to connected clients in real time.
The frontend is built with React and Mapbox GL. Districts are rendered as interactive 3D regions whose height and color change based on simulation state. Event impacts propagate across the map as visible wave ripples, making city-wide reactions easy to understand at a glance.
For deployment we used Vultr Cloud Compute, allowing us to run the simulation backend, database, and WebSocket services in a single environment.
Challenges we ran into
One of the biggest challenges was balancing realism with performance.
A fully agent-based simulation can quickly become computationally expensive. Running an AI model for every citizen in a city is impractical, especially in a hackathon environment. We solved this by creating a hierarchical architecture where archetype agents make high-level decisions and citizen agents provide variation.
Another challenge was maintaining simulation stability. Large language models are creative but not deterministic. We wanted the city state to remain consistent and reproducible, so we separated simulation logic from narrative generation. The deterministic engine computes the truth of the world, while AI is used only to generate believable human reactions.
Designing a visualization that judges could immediately understand was also difficult. We experimented with different representations before settling on a map-first interface where changes in city sentiment are reflected through district height, color, and propagation waves.
Finally, making the system scenario-agnostic required careful abstraction. Rather than building a World Cup simulator, we built a generic event-driven city simulation platform that can support many future scenarios.
Accomplishments that we're proud of
- Building a complete end-to-end city simulation platform in a hackathon timeframe.
- Creating a scalable two-layer AI architecture that produces believable behavior without excessive compute costs.
- Designing a deterministic simulation engine that remains stable while still feeling alive.
- Building a real-time 3D city visualization with live event propagation.
- Making the system flexible enough to support entirely different scenarios through configuration rather than code changes.
- Successfully combining AI-generated narratives with traditional simulation techniques in a way that improves realism without sacrificing reliability.
What we learned
We learned that the most effective use of AI is not always giving it complete control.
By combining deterministic systems with AI-generated narratives, we were able to create simulations that were both believable and dependable. Separating state computation from storytelling dramatically simplified debugging and improved performance.
We also learned that visualization matters as much as simulation. Complex systems become far more understandable when users can immediately see the effects of an event spread through a city.
Most importantly, we learned that emergent behavior often comes from simple rules interacting over time. Even relatively small numbers of agents can create surprisingly rich city dynamics when they are grounded in realistic environments and events.
What's next for AlgoPolis
Our goal is to evolve AlgoPolis into a general-purpose city simulation platform.
Future plans include:
- Supporting multiple cities and geographic regions.
- Adding richer citizen relationships and social networks.
- Introducing economic, transportation, and infrastructure systems.
- Creating scenario packs for elections, festivals, emergencies, policy changes, and sporting events.
- Allowing users to join simulations as active participants and influence outcomes directly.
- Building replay and timeline tools for exploring alternate futures and "what-if" scenarios.
- Expanding the platform into a tool for education, urban planning, public engagement, and large-scale social simulations.
We believe cities are one of the most complex systems humans have ever built. AlgoPolis is our attempt to make those systems visible, interactive, and understandable.
Built With
- anthropic-claude
- asyncio
- docker
- fastapi
- geojson
- mapbox-gl-js
- mongodb
- motor
- python
- react
- typescript
- vultr
- websockets
Log in or sign up for Devpost to join the conversation.