# Exactly Once

- **Event:** [Agents in Context Toronto: a MongoDB Hackathon](https://cerebralvalley.ai/e/mongodb-toronto-hackathon)
- **When:** Sat, Nov 14 at 9:00 AM – 9:00 PM (EST)
- **Where:** Toronto, Canada
- **Team:** [abhay kang](https://cerebralvalley.ai/u/abhaykang)
- **GitHub:** https://github.com/Abhaykang29/exactly-one
- **Demo video:** https://youtu.be/gyc_JFrwG70
- **Gallery:** https://cerebralvalley.ai/e/mongodb-toronto-hackathon/hackathon/gallery
- **Page:** https://cerebralvalley.ai/e/mongodb-toronto-hackathon/hackathon/gallery/48

Exactly Once: nothing counts without a receipt.

AI agents that take real actions crash. LangGraph with MongoDB's checkpointer resumes after a crash by re-running the interrupted step, side effects included, so customers get refunded twice, trades execute twice, and agents report "done" when the action never happened.

Exactly Once is a layer between any agent and the real world. Every action gets a receipt in MongoDB Atlas before it happens: intent, then sent, then proven by the real system. The AI's decision is frozen on the receipt. After a crash, the agent reads the receipt and checks the real system before acting again. An action counts as done only with evidence.

We raced three builds of the same agent (naive LangGraph, LangGraph's recommended one-step-per-action pattern, and Exactly Once) across four businesses: refunds, portfolio rebalancing, employee offboarding and recall alerts, crashing them at random.

Measured on Atlas:
- 100-order crash test: 116 double refunds for the naive agent, 0 for Exactly Once (crashed 144 times).
- Live four-business runs: both LangGraph builds paid or traded twice and claimed access was removed when it wasn't. Exactly Once was zero in every row of every run, with every action proven.

Refund decisions by Meta Muse via LangChain, traced in LangSmith. 15 automated tests on Atlas. Spec written before the event; all code written today.

## More from Agents in Context Toronto: a MongoDB Hackathon

- [Greenlight](https://cerebralvalley.ai/e/mongodb-toronto-hackathon/hackathon/gallery/45)
- [Stash](https://cerebralvalley.ai/e/mongodb-toronto-hackathon/hackathon/gallery/46)
- [SafeSpace](https://cerebralvalley.ai/e/mongodb-toronto-hackathon/hackathon/gallery/47)
- [GOTIA reversal Agent](https://cerebralvalley.ai/e/mongodb-toronto-hackathon/hackathon/gallery/49)
- [All Green](https://cerebralvalley.ai/e/mongodb-toronto-hackathon/hackathon/gallery/50)
- [All Clear](https://cerebralvalley.ai/e/mongodb-toronto-hackathon/hackathon/gallery/51)

---

Markdown version of https://cerebralvalley.ai/e/mongodb-toronto-hackathon/hackathon/gallery/48. Site index for agents: https://cerebralvalley.ai/llms.txt · full text: https://cerebralvalley.ai/llms-full.txt
