Inspiration
I have a Master's degree in Materials Science and 20 years of hands-on experience in the materials testing industry. For two decades, I watched the same bottleneck repeat itself across every lab I worked with: FTIR spectral analysis was fast to run but slow to interpret. Every sample required 30–60 minutes of expert judgment — manual library searches, literature cross-checks, written reports. The work demanded trained spectroscopists, and it didn't scale.
I knew this problem from the inside. So I taught myself Python and spent years building FTIR.fun: a spectral search engine backed by 130,000+ reference spectra and 28 file formats, now serving users in 55 countries. But my programming ability had a ceiling. The project stayed stuck in demo territory — functional, but never quite shippable. The AI reasoning layer I envisioned — one that could think like a domain expert, not just retrieve data — was always just out of reach.
Then the AI era arrived. Large language models with ReAct reasoning and tool-use gave me exactly the missing piece. What took me years to partially build, I could now complete. ChemSpectra Agent is the result: a 20-year industry problem, a self-built spectral library, and AI that finally closes the gap. This is not a hackathon prototype. It already has paying users.
What it does
ChemSpectra Agent is an AI autopilot for FTIR spectral analysis. Users upload a spectrum file or enter peak positions manually. A Qwen 3.7-Max ReAct agent then autonomously:
- Selects which analysis tools to call based on user intent
- Runs material identification against 130,000+ reference spectra, peak explanation, and functional group assignment
- Cross-validates results — if confidence falls below 0.75, it triggers an automatic self-verification round
- Applies chemical reasoning to override incorrect library matches
- Presents a full synthesis report with a human-in-the-loop confirmation checkpoint for regulated compliance
Every analysis session is persisted in AWS DynamoDB with full audit trail — session ID, top material match, confidence trace, tool call log, and timestamp. Sessions auto-expire after 30 days via TTL.
Live demo result: the spectral library ranked ABS as the top match at 39% confidence. The agent flagged it, ran three more verification tools, and correctly identified the sample as Polystyrene — because ABS requires a nitrile peak near 2237 cm⁻¹ that was completely absent from the spectrum. Six tool calls. Two ReAct rounds. One autonomous correction.
How we built it
- Frontend: Vercel-deployed Next.js app with a real-time Agent Reasoning Log. The UI polls a session endpoint every 2 seconds, surfacing live tool calls, confidence scores, and reasoning steps as they happen.
- Backend: FastAPI with async analysis sessions. POST
/api/analyzereturns a session ID in under 10ms — solving Cloudflare Tunnel's 100-second timeout without any infrastructure changes. Analysis runs in a background thread and results are fetched via GET/api/status/{id}. - AI Agent: Qwen 3.7-Max ReAct loop with five specialized tools: material identification, peak explanation, functional group assignment, library matching, and public result search. The agent decides which tools to call and in what order based on the user's query.
- Database: AWS DynamoDB for serverless session persistence with two Global Secondary Indexes (by creation time and by material) and atomic usage counters. Each session stores a
confidence_tracefield that records every confidence score across the full reasoning chain. - Spectral Library: FTIR.fun API — 130,000+ reference spectra, 28 file formats, built and maintained over several years of production use.
Challenges we ran into
The confidence gap. Spectral library matching with sparse peak lists is fundamentally noisy. The library ranked ABS first because the scoring algorithm only rewards peaks that are present — it cannot penalize absent peaks. ABS shares aromatic peaks with polystyrene and scores artificially high. The solution was engineering the agent to apply negative evidence: if a required diagnostic peak is absent, the candidate is disqualified regardless of library rank. This required encoding 20 years of spectroscopic judgment into tool descriptions and system prompts.
Latency under deep reasoning. When library confidence is low and the agent enters multi-round verification, total LLM reasoning time can reach 3–5 minutes. A synchronous API would time out at the infrastructure layer long before the analysis completes. We redesigned the API around async sessions: POST returns a session ID in under 10ms, and the frontend polls for status every 2 seconds. The reasoning runs to completion regardless of how many ReAct rounds it requires, and the user sees live tool calls appearing in real time rather than a blank wait screen.
Spectral library coverage across industries. FTIR is not a single-domain technique. The same instrument serves pharmaceutical QC, polymer manufacturing, forensic evidence analysis, environmental testing, and archaeological conservation — each with its own compound vocabulary, regulatory context, and interpretation conventions. A library strong in polymers is thin on archaeological resins; one optimized for pharma may miss industrial lubricant additives entirely. Keeping coverage current across all these domains is a continuous challenge: new materials enter the market faster than any static library can be updated. Our response is two-pronged — the agent draws on the LLM's broad chemical knowledge to reason about compounds absent from the library, and users in specialized fields are invited to contribute verified spectra, turning domain diversity from a liability into a community-driven asset.
Accomplishments that we're proud of
The most meaningful validation didn't come from a benchmark — it came from users.
After deploying ChemSpectra Agent, working spectroscopists told us the results matched what they would have concluded manually. Several went further: they volunteered their own FTIR spectra to improve the library. That kind of contribution — domain experts choosing to give back rather than just consume — tells us the tool is genuinely useful, not just impressive in a demo.
And users are paying for it. Not because we pushed a subscription, but because they found enough value to support continued development. For a solo project built by one person outside of a software engineering background, that is the metric that matters most.
On the technical side: a ReAct agent that autonomously overrides a wrong library result using negative-evidence chemical reasoning is something we're proud of. It's not a trick. It's spectroscopic logic, encoded as agent behavior, validated against real lab samples.
What we learned
AI is remarkably capable in domains that have traditionally required years of accumulated experience. FTIR interpretation is exactly that kind of domain — pattern recognition layered with chemical intuition, the kind of knowledge that takes decades to develop and is nearly impossible to fully document.
What surprised us was not just that AI could reason about spectra, but that it needed continuous correction from domain experts to do it reliably. The model's chemical knowledge is broad but uneven — it handles common polymers confidently and struggles with edge cases in industrial additives and formulations. Every correction we fed back into the system prompt and tool descriptions made it measurably better.
The lesson: AI doesn't replace domain expertise in complex analytical fields. It amplifies it. The bottleneck shifted from "can the AI reason about this?" to "does the domain expert have the time to keep teaching it?" That's a fundamentally different problem — and a much more tractable one.
What's next for ChemSpectra Agent
Deeper knowledge graph and RAG for characteristic peak interpretation. Today the agent reasons from general chemical knowledge embedded in the LLM. The next version will have a structured knowledge graph of functional group → wavenumber → compound class relationships, with RAG over curated spectroscopy literature. This will make peak assignment more rigorous and fully traceable, especially for industrial edge cases.
MCP API for cross-platform integration. We're building a Model Context Protocol API so ChemSpectra Agent can be called as a tool by other AI systems — not just by users directly. The first target: AI-assisted scientific writing. A researcher writing a characterization paper should be able to ask their writing AI to interpret a spectrum inline, without switching tools or exporting files.
User-contributed library at scale. Users are already voluntarily contributing their spectra. We'll build a structured contribution workflow with domain-expert review, creating a continuously improving dataset of real industrial samples that no commercial library vendor can match on niche materials and formulations.
Built With
- amazon-web-services
- cloudflare
- dynamodb
- edge-tts
- fastapi
- ffmpeg
- gsap
- next.js
- python
- qwen
- react
- selenium
- tailwindcss
- tunnel
- typescript
- vercel
Log in or sign up for Devpost to join the conversation.