Part 3 of a series on building an AI-powered operations assistant using Spring AI and MongoDB Atlas. This installment introduces stateful workflow checkpointing to handle multi-step incident investigations that span session boundaries. Key additions include: a checkpoint document stored in MongoDB tracking workflow state, current step, and status (RUNNING, WAITING_APPROVAL, COMPLETED, FAILED); a ServiceStatusTool annotated with @Tool that lets the model fetch real-time service metrics; ThreadLocal-based context propagation for passing conversation IDs into tool methods; ToolExecution audit documents for full traceability; and pause/resume API endpoints that rehydrate investigation state. MongoDB serves as a unified persistence layer for runbooks, conversation memory, long-term knowledge, and workflow checkpoints. The architecture allows horizontal scaling since workflow state lives outside any single instance.

15m read timeFrom foojay.io
Post cover image
Table of contents
The Remaining GapWhat We Are BuildingThe Core Idea: Externalizing Workflow StateThe Checkpoint DocumentCheckpoint LifecycleGiving the Model the Ability to Observe The SystemsPropagating Context Into Tool MethodsAudit Trails with ToolExecutionPause, Inspect, ResumeA Demo ScenarioWhat This Architecture Makes PossibleConclusion
279 Impressions