Inspiration
We live in an era of rapid policy shifts—from green energy taxes to AI regulations—yet we often fly blind when it comes to the "human friction" these changes cause. Traditional surveys are static and spreadsheets can't feel. I was inspired to move AI beyond simple "chat" and into the realm of Agentic Social Simulation. I wanted to build a tool that gives policymakers a "crystal ball" to see not just the economic numbers, but the emotional and ethical trade-offs people face when their world changes.
What it does
The Digital Twin Ethics Sandbox is a behavioral modeling engine. It uses the Gemini 3 API to generate and manage 100+ distinct AI Personas with unique demographics, values, and financial baselines. When a "societal shock" (like a new tax or a strike) is introduced, the system simulates a full year of life across four quarters. It tracks how these personas debate, struggle, and adapt, outputting structured data that visualizes the "Happiness Heartbeat" and "Economic Pressure" of the city through a professional Tableau dashboard.
How we built it
The project is built on a robust Python backend using the google-genai SDK.
Gemini 3 Integration: We utilized Stateful Agentic Workflows to ensure personas "remember" their past quarters.
Data Integrity: We used Pydantic Schemas to enforce "Structured Outputs," ensuring the AI acts as a reliable data engine for our analytics.
Visualization: We processed the AI's "sociological data" into a flattened CSV, which feeds into a Tableau Story that maps sentiment trends, dissent ratios, and ethical word clouds.
Challenges we ran into
The biggest hurdle was Agentic Drift—ensuring that a persona didn't lose their core identity (like "Frugality" or "Community Trust") after multiple rounds of simulation. We solved this by injecting the original "Persona Object" into the System Instructions for every turn. We also navigated API Rate Limits (429 errors) by implementing an Exponential Backoff retry logic, which ensured our multi-quarter simulation could complete without interruption.
Accomplishments that we're proud of
I am most proud of the Contrarian Rule. We successfully prompted the AI to ensure that at least 15% of the population adopted a minority or "irrational" viewpoint. This created a much more realistic simulation of social polarization than a standard LLM output, which tends to seek consensus. Seeing the "Dissent" actually appear on the Tableau charts was a huge win.
What we learned
Building this project taught me the power of Structured Reasoning. I learned that LLMs aren't just for generating text; they are incredible at simulating complex, multi-variable systems if you provide the right constraints. I also learned how to bridge the gap between "Raw AI Output" and "Actionable Business Intelligence" using data visualization tools.
What's next for The Digital Twin Ethics Sandbox
The next phase involves Multi-Agent Interaction, where personas don't just react to a shock, but actually "debate" each other in simulated town halls to influence the next quarter's sentiment. I also plan to integrate TabPy (Tableau Python Server) to allow users to adjust "Shock Parameters" with a slider in Tableau and see the digital twins react in real-time.
Built With
- gemini-3-api
- pandas
- pydantic-(structured-outputs)
- python-(google-genai-sdk)
- python-dotenv.
- tableau-(bi-&-visualization)
Log in or sign up for Devpost to join the conversation.