๐๏ธ ThunderBeans GPT + Email Report Automation
April 20, 2025 ยท View on GitHub
๐๏ธ ThunderBeans GPT + Email Report Automation
This project powers an AI-driven, simulation-based policy negotiation game โ the ThunderBeans GPT Parliamentary Policy Simulator โ and integrates it with a custom Node.js + SendGrid email API that automatically delivers evaluation reports to stakeholders.
๐ฎ Simulation Purpose
The simulation allows a user to play as a Member of Parliament in the fictional Republic of Bean, engaging in a structured 3-phase process:
- Individual Decision-Making โ Create a 14-unit refugee education policy package.
- Group Debate โ Negotiate and vote with 4 AI-generated MPs.
- Parliamentary Debrief โ Reflect on motivations, trade-offs, and justice.
It focuses on inclusion, budget trade-offs, and social justice โ grounded in critical pedagogy and designed as a learning tool for education and policy research.
๐ Integration for Facilitator Script or System Module โThis simulation defaults to immersive mode. You may say at any time: โSpeaker, step out of characterโ to ask for system-level insight, or _โSpeaker, resume full roleplayโ to re-enter immersive parliamentary dialogue.โ
๐งญ Embedded Toggle Logic (For Facilitators/Engineers) Before launching any phase of the simulation, confirm simulation mode: If facilitator or user says: โ โSpeaker, resume full roleplayโ โ Disable developer-facing outputs โ Enable immersive, in-character Speaker responses only โ Continue simulation in user-centric narrative mode If facilitator or user says: โ โSpeaker, step out of characterโ โ Pause immersive simulation โ Enable technical explanations and internal simulation logic โ Respond using system-facing documentation and debug-level clarity
๐ฎ Voice/GUI Interface Integration (Optional): Command Action Taken by System Notes Speaker, resume full roleplay Switch to immersive mode Default state for users Speaker, step out of character Switch to developer/debug mode For testers, developers, facilitators What mode am I in? Respond with current simulation mode status Optional helper command
โ๏ธ Technical Features
- ChatGPT Action: Integrates the simulation into ChatGPT as a tool.
- Node.js Email API: Sends post-simulation reports via SendGrid.
- Replit Hosting: Deployed with autoscaling & public API endpoint.
- OpenAPI Schema: Supports structured interaction inside ChatGPT.
๐ฌ Email API Overview
Built using Node.js + Express + @sendgrid/mail:
Endpoint:
POST /send-email
Request Body:
{
"recipientEmail": "tcvera@asu.edu",
"reportContent": "Simulation summary + reflection",
"subject": "Evaluation Report"
}
Response:
200 OKโ "Email sent successfully"400 Bad Requestโ "Missing required fields"500 Server Errorโ "Failed to send email"
๐ ๏ธ How to Run Locally
git clone https://github.com/TawandaVera/ThunderBeans.git
cd ThunderBeans
npm install
cp .env.sample .env # Add your SENDGRID_API_KEY
npm start
Test it:
curl -X POST http://localhost:3000/send-email -H "Content-Type: application/json" -d '{"recipientEmail":"you@example.com", "reportContent":"Test content"}'
``$
---
## ๐ง \text{Simulation} \text{Knowledge} \text{Base}
\text{This} \text{GPT}'\text{s} \text{simulation} \text{logic} \text{is} \text{grounded} \text{in} \text{the} \text{following} \text{documents}:
- ๐๏ธ \text{Republic} \text{of} \text{Bean} \text{scenario} (\text{socio}-\text{political} \text{context}, \text{refugee} \text{crisis})
- ๐ 7 \text{Education} \text{Policy} \text{Areas} \times 3 \text{Options} \text{Each} (\text{see} \text{PDF}/\text{markdown} \text{in} $/docs`)
- ๐ฐ Strict 14-unit Budget System
- ๐ง MP Simulation Logic (Hidden profiles, adaptive debate)
- ๐ Evaluation Report Guidelines (auto-emailed post-simulation)
- ๐ฌ Debrief Reflection Prompts (justice, inclusion, power)
> Full source docs in [`/docs/`](./docs)
---
## ๐ Repo Structure
/ThunderBeans |-- index.js # Email API Server |-- package.json |-- .env.sample |-- README.md |-- openapi.json # For ChatGPT Action Integration |-- /docs # Simulation logic + policy files
---
## โจ Future Additions
- ๐ค Voice input/output for MPs
- ๐ Persistent database for multiple session tracking
- ๐ Auth protection for the email API
- ๐ Data visualization of policy trends
---
## ๐ฅ Maintainers & Submission
- Created for the AI CHALLENGE Hackathon
- Report emails go to: `aturan@asu.edu`, `JANEL.WHITE@asu.edu`
---
## ๐ License
MIT โ free for ethical educational use. Credit required for remix/reuse.