Inspiration

Film and TV productions constantly weave real-world facts into their scripts — historical dates, scientific claims, biographical details — because audiences notice when something is wrong, and inaccuracies can undermine a story's credibility. Traditionally, checking these facts falls to researchers who comb through scripts line by line, which is slow and easy to get wrong under production deadlines.

When we saw Agentic Cinema's challenge to build agentic apps for media and entertainment workflows using Google's Gemini alongside a partner tool, this felt like the perfect problem to solve: could an AI agent read a script the way a human fact-checker would, but do it in seconds instead of hours? Parallel's real-time web search was the missing piece — it meant the agent wouldn't just rely on what a model already "knew," but could pull current, verifiable evidence for every single claim.

What it does

Paste any scene from a script, and the agent extracts every checkable factual claim, searches the web in real time using Parallel, and uses Gemini to judge each claim as correct, incorrect, or unverifiable — providing corrections with sources when something is wrong.

How we built it

Built with Python and Streamlit for the interface. The core is a three-stage pipeline: first, Gemini reads the full script scene and extracts every specific, checkable factual claim into a structured list — filtering out opinions and clearly fictional dialogue along the way.

For each claim, we call Parallel's Search API to gather real-time web evidence — titles, URLs, and excerpts from live search results — rather than relying on the model's static training data. This step is what lets the agent catch claims about very recent events or correct itself when its own "knowledge" is outdated.

That evidence is then passed back to Gemini, which acts as the judge: it compares the claim against the search results and returns a structured verdict — correct, incorrect, or unverifiable — along with a one-line explanation and, when applicable, the correct fact. We used Pydantic schemas with Gemini's structured output mode throughout, so every response comes back as clean, parseable JSON instead of free-form text we'd have to guess at.

The whole thing is hosted on Streamlit Community Cloud, deployed straight from a public GitHub repo, with API keys managed through Streamlit's built-in secrets rather than hardcoded anywhere.

Challenges we ran into

The biggest technical challenge was working within Gemini's free-tier API rate limits. Early versions of the agent would crash entirely if a single API call got rate-limited mid-run — unacceptable for a live demo. We rebuilt the pipeline with retry-with-backoff around every Gemini call, switched to the lighter gemini-2.5-flash-lite model for a higher request quota, and added deliberate pauses between claims. The result degrades gracefully now — worst case, one claim comes back "unverifiable" instead of the whole app failing.

We also built and hosted everything on a second-hand laptop with modest specs, which shaped a lot of our tooling choices: browser-based, free platforms (GitHub's web editor, Streamlit Community Cloud, Microsoft Clipchamp) instead of heavier local IDEs or desktop software, so nothing depended on hardware we didn't have.

Producing the demo video turned out to be its own project — syncing AI-generated voiceover narration with a screen recording, closing visual gaps after export, and getting audio and video tracks aligned took nearly as much iteration as the agent's code did.

Accomplishments that we're proud of

The biggest technical challenge was working within Gemini's free-tier API rate limits. Early versions of the agent would crash entirely if a single API call got rate-limited mid-run — unacceptable for a live demo. We rebuilt the pipeline with retry-with-backoff around every Gemini call, switched to the lighter gemini-2.5-flash-lite model for a higher request quota, and added deliberate pauses between claims. The result degrades gracefully now — worst case, one claim comes back "unverifiable" instead of the whole app failing.

We also built and hosted everything on a second-hand laptop with modest specs, which shaped a lot of our tooling choices: browser-based, free platforms (GitHub's web editor, Streamlit Community Cloud, Microsoft Clipchamp) instead of heavier local IDEs or desktop software, so nothing depended on hardware we didn't have.

Producing the demo video turned out to be its own project — syncing AI-generated voiceover narration with a screen recording, closing visual gaps after export, and getting audio and video tracks aligned took nearly as much iteration as the agent's code did.

What we learned

We learned how to work with real, external APIs in a production setting — not just calling them, but handling them responsibly. That meant understanding rate limits before they broke our app, keeping API keys out of source code entirely (using environment-based secrets instead of hardcoding them, and double-checking that nothing sensitive ever got pushed to a public GitHub repo), and building in retries and graceful fallbacks so a single failed call doesn't take down the whole experience.

We also learned the value of structured outputs — asking Gemini to return validated JSON via Pydantic schemas instead of free-form text made the whole pipeline far more reliable, since we never had to parse or guess at loosely formatted responses.

Beyond the code, we learned a lot about deployment: the difference between a development preview and a real production deployment, how platform-specific routing and hosting quirks can block an otherwise-working app, and why it's worth testing a live public link in an incognito window before trusting it's actually working for someone else.

What's next for Script Fact-Checker

The most immediate next step is moving beyond pasted text to real file uploads — supporting PDF and Final Draft (.fdx) script formats directly, so writers and production teams don't have to copy-paste scenes manually. Alongside that, batch processing an entire screenplay at once, rather than one scene at a time, would make this genuinely usable in a real production workflow.

On the technical side, we'd like to reduce how many separate API calls the pipeline makes per script — batching multiple claims into a single Gemini request instead of one call each — which would both cut down on rate-limit issues and make results come back faster. We'd also add a confidence or severity indicator, since a wrong date in a throwaway line matters less than a factual error central to the plot.

Longer term, the goal is to move this from a standalone web app into the tools writers already use — a plugin for screenwriting software like Final Draft or Celtx, so fact-checking happens right inside the writing process instead of as a separate step. We'd also like to generate a shareable "verified sources" report for each script, giving production and legal teams a paper trail of what was checked and how.

Built With

  • ai-agents
  • google-gemini
  • parallel-api
  • python
  • streamlit
Share this project:

Updates

Submission history