How I Built a Self-Verifying AI Agent with DynamoDB and ReAct Reasoning A developer built ChemSpectra Agent, an FTIR spectral analysis system that uses a ReAct loop with Qwen-3.7-Max function calling to autonomously select from five analytical tools and self-verify its conclusions. The system detects evidence conflicts between tools, estimates confidence, and automatically triggers verification rounds when confidence is below 0.75 or conflicts exist, with all sessions persisted to DynamoDB for audit trails. Built for the H0Hackathon — Hack the Zero Stack with Vercel v0 and AWS Databases Most AI pipelines follow a fixed script: input in, output out, nobody checks the work. For the H0 hackathon Track 2: Monetizable B2B App , I built ChemSpectra Agent — an FTIR spectral analysis system where the AI verifies its own conclusions and self-corrects when evidence conflicts. Instead of hardcoding which tools to call, the agent uses a ReAct loop with Qwen-3.7-Max function calling. The LLM autonomously selects from 5 tools — identify material 130K+ reference spectra , explain peaks , assign functional groups , match library topk , and search public results . A material ID request might trigger two tools; a deformulation request triggers all three analytical tools. The LLM decides, not the developer. After tools return results, detect evidence conflicts compares outputs. If identify material says "PET" but assign functional groups found no ester groups, that's a contradiction: expected groups = { "pet": "ester", "c=o", "aromatic" , "nylon": "amide", "n-h", "c=o" , } The agent estimates confidence from match scores, candidate score gaps, and functional group coverage. Below 0.75 confidence or any conflicts, a verification round fires automatically: needs verification = confidence < 0.75 or len conflicts 0 The agent gets told exactly what went wrong and calls additional tools to investigate. Post-verification confidence is logged, creating traces like 0.62, 0.84 . Every session persists to DynamoDB with 30-day TTL — tool call logs, confidence traces, synthesis, final report. But we went deeper than basic CRUD: gsi-created partition: ALL , sort: created at replaces full-table scan with efficient time-ordered query; gsi-material partition: top match , sort: created at enables "show me all PET analyses" aggregation chemspectra-stats table tracks total analyses and total tools called via DynamoDB ADD operations, safe under concurrent requests attribute not exists session id OR step < :confirmed to prevent concurrent overwrites of finalized reportsRegulated industries pharma, forensics require this audit trail. DynamoDB fits because the primary access is single-item by session id , the GSIs cover the two secondary patterns, and TTL handles cleanup automatically. The loop runs 2-4 iterations in under 30 seconds. Self-repair for malformed LLM JSON has near-100% recovery. This turns "AI that gives answers" into "AI that checks its work" — essential when reports go into regulatory filings. Try it : chemspectra-agent-h0.vercel.app https://chemspectra-agent-h0.vercel.app | Code : github.com/jxbaoxiaodong/chemspectra-agent-h0 https://github.com/jxbaoxiaodong/chemspectra-agent-h0 This article was written as part of my participation in the H0 AWS+Vercel Hackathon.