Inspiration

Political science students learn campaigns from the outside: readings, polls and case write-ups, all written after the result is known. They never have to make the calls themselves: how to spend a limited budget, which voters to go after, what to tell a team, what to do when a famous rival enters the race with millions to spend. And once you know how a race ended, every choice in it looks obvious.

We wanted to put a student inside a real race, on its real calendar, without telling them how it ends. Give them a staff to direct, rivals who fight back and a press that reports it all. At the end, show them their result beside the real one, so they learn from the gap between their choices and history.

What it does

The War room during a live order

Campaign Academy is a learning tool for political science students to simulate real campaigns. It turns a real race into a case: a sourced record of the candidates, polls, money, events and voters, plus the moments where the real campaign had to decide. A new race is new data, not new code. We built one case: the 2013 Democratic primary for Mayor of New York, run from inside Bill de Blasio's campaign.

What makes it different

  • The race is real. Polls, money, events and voters come from 55 sources, and every fact on screen is cited. The simulation is fitted to the record, so playing the real choices lands on the real result.
  • The people are live agents. Your staff and your rivals are LangChain deep agents. Directors plan, hand jobs to their own teams, spend simulated money through the simulation engine and report back. Rivals plan their own moves.
  • No hindsight. The agents know only what was known on the campaign's date, and a filter drops anything that leaks the future.
  • You learn from the gap. After each decision you see what the real campaign did. How it turned out for them is held back to the end.

How a student plays

  1. The briefing. The race as it really stood when the campaign began.
  2. A decision point. On a real date, the clock stops. Two of the student's own staff each argue for a different option. Each option shows its price and which way it moves things, but not by how much: the student decides on judgment.
  3. The record is shown. After choosing, the student sees what changed (polls, money, voter groups) and what the real campaign did: "the same call you made" or "a different call".
  4. The campaign runs. Between decisions the student directs staff in plain language, sends the candidate to knock doors, hold rallies or host house parties on a real map of the city, adds planks to the platform and sets a weekly spending plan. Rival campaigns make their own moves, and a morning paper reports it all.
  5. Election night. The count comes in district by district, then the certified result appears beside the student's.

Inside the tool

  • Case: the briefing, the decisions, and what the real campaign did.
  • War room: a 3D room of the staff. Click a director, give an order, and watch their reasoning and hand-offs live. Hire, let people go, approve requests for more money.
  • Map: real New York streets and 59 community districts, coloured by your support, with census data and 311 requests for each.
  • Factions: 22 voter groups from the real polls, sized by share of the vote, with the groups that pull together or apart.
  • Morning paper: the lead is the real headline of the day, cited; the rest is simulated, and the student can answer the story with a stance drafted by the comms team.
  • Top bar: money left, the polls, the rivals' latest moves, and the weekly spending plan.

Honest by design

  • Every statement of fact has a source; anything estimated says so.
  • Every number is labelled Real data or Simulated.
  • The tool never recommends. Advice comes only from the student's staff, in their own voices.
  • The real choice is shown only after the student decides, and it is not always the right one.
  • A real person appears in a staff post only where the record names them in it. The rest of the staff are invented.
  • What the campaign really chose, how it turned out and what was said afterwards never reach an agent's prompt.

How we built it

Figure 2: system architecture

The campaign lives in the browser: the case file, a daily clock and a pure simulation engine (simulate(): decisions and work in, campaign state out). The agents run on the server behind Next.js API routes. Each request carries a snapshot of the campaign, and the server keeps nothing between requests. Every live part has a rules fallback that emits the same events, so the tool runs even with no API key.

Figure 3: processing of one staff order

One staff order, step by step

  1. Instruction. The student writes to one director in plain language. The order's budget is read from the text ($80,000 by default, at most $250,000, never more than the campaign has).
  2. Context. The browser sends the director a snapshot of the campaign: date, cash, polls, calendar, platform, voter groups and support in every district. The director's memory file (/memory/AGENTS.md, up to 12 lines from earlier orders) and the action catalog with prices are added.
  3. Director. A deep agent on Claude Opus 5.5 plans the order, splits it into jobs and gives each one, through the task tool, to the person on its team whose strengths fit.
  4. Team. Each team member is a subagent on Claude Haiku 5.5 with its own prompt and voice. It sees only its brief and acts through one tool, take_action, writing its reason before its choice. Independent jobs run in parallel.
  5. Engine. Every action goes through the same engine as the rest of the simulation, which prices it, refuses it if the order's budget is spent, and moves support in districts and voter groups.
  6. Report and guards. The director closes the order with send_report. A figure the agent was never shown is sent back once, then cut; any sentence that reaches past the campaign's date is removed. The memory file records the order.
  7. Live view. Every step streams to the War room as it happens: the student watches each agent's reasoning, sees the hand-offs drawn between director and team, and gets the report with a grade for how well the order was delegated.

Every deep agent in the tool

  • Staff director (one per post): createDeepAgent with its team as subagents through task, run in parallel; a memory file per post; custom tools take_action, send_report and propose (2–3 priced options for questions).
  • Staff under a director: SubAgent specs, each with its own model, voice and one tool.
  • Rival campaigns: one deep agent per rival, all in parallel after each decision, acting through make_move with $150,000 and scored by the same engine.
  • End-of-election debrief: a read-only deep agent on Claude Sonnet 5.5 with write_todos, a virtual filesystem of the whole campaign and the sourced record, and seven subagents in parallel (one per decision, plus a campaign reviewer). Every citation must be a real source and every figure must appear in the files.
  • Evals campaigner: read tools and one decide tool, every run traced in LangSmith.

Other AI in the tool

  • Gemini (gemini-3.8-flash, @google/genai) writes the morning paper: stories about the student's campaign and the rivals, letters to the editor, and the stances a student can answer a story with. Every story passes the same number check as the agents. The lead story is always the real headline, and the model never writes it. Claude is the fallback.
  • Claude writes the two decision memos before each decision (the option each writer argues for is assigned by rotation, because left to choose, the model picked the real 2013 option every time), shapes the student's ideas into platform planks, drafts staff remarks and writes hiring shortlists.
  • Photon iMessage: text a code to the project's line and staff remarks arrive as texts; reply YES or with your own order, and the report comes back in the thread.

Stack: Next.js 16, React 19, TypeScript, Tailwind, zustand, MapLibre with NYC Open Data, LangChain deepagents, @langchain/anthropic, LangSmith, @google/genai, Photon Spectrum.

Does it work?

The simulation is fitted. The real campaign's six choices, with the rivals acting and a typical weekly plan, land every candidate within 0.2 points of the certified result (de Blasio 40.9% against the certified 40.81%). An automated check fails if that drifts. Play the weakest choices with no staff work and you finish third, at 8.3%.

Evals: do the agents decide as the real people did? We tested it with no student: an agent plays de Blasio, the live agents play everyone else, and each sees only facts dated before the decision. However, the model already knows this race: asked with no card at all, it names the real choice at five of six decisions, so plain agreement mostly measures memory. What memory can't fake is whether the choices follow the facts on the card:

  • Rewrite the facts to point away from the 2013 choice, and the agent moves 78% of the time (28 of 36).
  • Reword the same facts, and it holds its choice 94% of the time (17 of 18).
  • Where its memory is wrong and the card is right, it chose what really happened 11 of 11 times.
  • The whole campaign on its own, January to September: 6 of 6 real choices, 32 weekly staff meetings, 294 staff jobs.
  • On 11 held-out decisions it was never tuned on, the card adds little to memory: 70% against 67%.

The honest summary: the agents are grounded in the evidence they are given, but they don't reproduce real choices beyond what the model already remembers.

Validation. We wrote to about 60 political science professors and students while we built it. Six replied, and three students tried the tool. Prof. Samuel S.-H. Wang (Princeton) replied that the big unknown is how effective advertising and paid media are, and that budgeting matters because different campaign materials cost different amounts. So every action in the simulation has its own price, the student sets a weekly spending plan across doors, rallies, press, mail and digital ads, and how much each kind of spending moves voters is fitted to the record and labelled as simulated.

Tracks

Education (main track)

Campaign Academy is built around how case-method teaching works, with the decision made by the student instead of read about:

  • Real material, cited. Every fact links to its source, so a class can check it and argue with it.
  • Judgment before feedback. Options preview only the direction of an effect, not its size. The student chooses, then sees what moved, then what the real campaign did.
  • Four skills a course can assess: delegating (each order is graded on clarity and on giving the job to the right people), budgeting, reading voter groups and weighing policy trade-offs.
  • No answer key. The tool never says which option was best, and the real choice is not always the right one.
  • More cases are data, not code. A new race is one researched case file.

LangChain: Best use of deepagents

Every live staff member, every rival and the end-of-election debrief is a LangChain deep agent (deepagents 1.16.5): directors with their teams as subagents through task, run in parallel; memory files per post; custom tools that act only through the simulation engine; a read-only virtual filesystem with write_todos and seven parallel subagents for the debrief. The War room streams the agents' reasoning and hand-offs live, and the evals are traced in LangSmith. We also say plainly what isn't built yet: the staff directors don't use write_todos, there is no checkpointer, and staff traces aren't flushed on Vercel.

Amazon: Best Practical AI Innovation

  • Agentic behavior. Directors plan an order, split it into jobs, hand them to subagents and act through tools, over many steps. Rival campaigns plan and act on their own.
  • Real-world impact. Students learn campaigns from readings written after the result. Here they make the calls on a real race, with every fact cited, and compare themselves with what really happened.
  • Adaptive intelligence. Each director keeps a memory of what worked in this campaign and comes back with follow-ups. Staff speak up when money runs low, a voter group slips or a rival moves. Every order is graded on how well it was delegated.
  • User-friendly design. Orders are plain language, the agents' reasoning is shown live, and every number says whether it is real or simulated.
  • Reliable. Every live part has a rules fallback, so the tool runs with no API key, and an automated check keeps the simulation on the real result.

Peri: Forward Deployed Challenge

  • Organization: Princeton University.
  • Person consulted: Prof. Samuel S.-H. Wang, Princeton Neuroscience Institute.
  • Evidence: a direct quote from his email reply of 14 November 2026: "the big unknown is how effective advertising and other paid media are".
  • What we built from it: every action has its own price, the student sets a weekly spending plan across doors, rallies, press, mail and digital ads, and the effect of each kind of spending is fitted to the record and labelled as simulated, not presented as known. It runs in a browser with no setup, so a class can use it today.

MLH: Best Use of Gemini API

Gemini (gemini-3.8-flash through @google/genai) writes the morning paper: the simulated stories about the student's campaign and the rivals, the letters to the editor, and the three stances a student can answer a story with. Every story passes the same number check as the agents, so a figure that isn't in the campaign's facts gets the story rejected. The masthead names the writer. The lead story is always the real headline of the day, cited, and the model never writes it.

Photon: messaging agent

Text a code to the project's iMessage line and the staff text you. Remarks arrive signed by the post with a suggested order; reply YES or write your own order, and the report comes back as a threaded reply, with a 👍 tapback when the order lands and a typing bubble while the staff work.

Challenges we ran into

  • The model already knows this race. Masking names didn't hide it: the model recognised the race on every masked card and on every "twin" moved to an invented city. So we changed what we measure, from agreement to grounding: changed facts against a reworded control, and agreement where memory is wrong.
  • Keeping the future out. Agents kept leaking how the race ended ("won the primary", "Mayor de Blasio"). Every output now passes a hindsight filter, and memo writers are assigned their option by rotation.
  • Agents inventing numbers. One order once spent $816,150 and reports quoted figures nobody gave them. Now a number ledger holds every figure an agent was shown, anything else is sent back, and each order has its own budget capped at $250,000.
  • The chips gave answers away. The up/down previews were fitted to the real situation, so on rewritten cards they contradicted the new facts. The evals drop them on those cards.
  • Deploying agents on Vercel. A LangGraph dependency shipped ES modules without a package.json, which broke every agent route in production until we patched it on install.

Accomplishments that we're proud of

  • Live deep agents a student can direct in plain language, with their reasoning and hand-offs visible as they work.
  • A simulation that lands on the real result when you play the real choices, and lets you lose when you don't.
  • Every fact cited, with the record and the simulation kept strictly apart.
  • Honest evals that show where the agents follow evidence and where memory still does the work, and report the weak result as plainly as the strong one.
  • Feedback from a Princeton professor, built into how spending works.

What we learned

  • Grounding is measurable even when a model already knows the answer: change the evidence, keep the wording, and see what moves.
  • Agents should choose and explain; deterministic code should hold the numbers.
  • Making the agents' work visible is what makes them teachable.
  • A model left to choose will replay history it remembers, so where it matters, assign the side and let it argue.

What's next for Campaign Academy

  • More cases: each new race is one researched case file, not new code.
  • Class mode: a teacher assigns a case and compares how students decided.
  • Playing the same race from a rival campaign's side.
  • Wiring planning (write_todos) into the staff directors, and resuming runs instead of restarting them when the student approves more money.

Built With

Share this project:

Updates

Submission history