Inspiration
Historical continuity is expensive in a quiet way. A screenplay can feel convincing for ninety pages, yet one product released five years too late can instantly break the audience’s trust.
Writers and production researchers can manually investigate every technology, product, company, institution, and public event mentioned in a script, but that process is slow, inconsistent, and difficult to audit. We wanted to build an agent that works like a careful historical research assistant while leaving the final creative decision with the writer.
What it does
PeriodCheck fact-checks the historical accuracy of period screenplays.
A writer uploads a PDF and provides the story’s intended year and location. PeriodCheck then:
- Reads the screenplay and preserves page-and-line references.
- Extracts independently verifiable historical claims.
- Researches each claim through Parallel Search.
- Determines whether it is supported, anachronistic, uncertain, or not verifiable.
- Returns an annotated screenplay with explanations, citations, confidence scores, and minimal suggested corrections.
For example, a screenplay set in 1985 may correctly mention a Macintosh or Sony Walkman but incorrectly include Google Maps, DVDs, or a web browser.
Confirmed verdicts require authoritative evidence. When evidence is weak or conflicting, PeriodCheck reports uncertainty instead of manufacturing confidence.
How we built it
PeriodCheck is a FastAPI web application deployed on Google Cloud Run.
The workflow begins with Google Document AI Enterprise OCR, which parses the uploaded PDF and creates stable page-and-line anchors. Those anchors ensure every finding can be traced back to the exact screenplay text that produced it.
Gemini 2.5 Flash on Vertex AI then extracts structured historical claims. We designed the extraction step to separate independently researchable facts—for example, a web browser and the World Wide Web are related but distinct historical claims.
A research agent built with the Google Agent Development Kit plans searches and invokes the Parallel Search API at runtime. Parallel returns live web results, excerpts, URLs, dates, and search identifiers.
The backend then applies deterministic validation:
- Every result receives a stable evidence ID.
- Citations are hydrated from the exact Parallel response.
- Confirmed verdicts must cite acceptable evidence.
- Authoritative sources are preferred over secondary sources.
- Weak sourcing can trigger a bounded, targeted retry.
- Search calls are limited to control cost and prevent agent loops.
- Every attempt retains its queries, source counts, Parallel search IDs, and validation result.
Secrets are stored in Google Secret Manager, while Cloud Run hosts the public application and agent runtime.
Challenges we ran into
Preserving screenplay provenance
OCR text alone was not enough. We needed every claim and verdict to remain connected to the correct PDF page and line, including claims crossing page boundaries. Stable line IDs and strict anchor validation solved this.
Preventing invented citations
A model can produce a plausible URL that was never returned by the search tool. We therefore stopped trusting model-generated URLs. The model selects stable evidence IDs, and the backend reconstructs citations directly from the corresponding Parallel results.
Distinguishing related claims
A single screenplay line can contain multiple historical facts. Early versions sometimes merged a product with the network, service, or institution it used. We improved the extraction instructions and validation rules so those facts are researched independently.
Finding authoritative evidence
Broad searches often returned summaries even when museums, manufacturers, standards bodies, universities, or government archives were available. We added source-quality classification, authoritative-domain retries, and evidence-selection repair.
Maintaining reliable structured output
Agent responses occasionally included malformed JSON or an invalid evidence selection. Strict Pydantic schemas, bounded retries, and deterministic backend validation allowed the pipeline to fail safely instead of displaying unsupported findings.
Deploying asynchronous research
The hosted workflow continues researching after the upload request completes. We configured Cloud Run with CPU availability between polling requests, bounded concurrency, and a single instance because the MVP currently stores job state in memory.
Accomplishments that we're proud of
- Built a complete hosted PDF-to-report workflow using Google Cloud and Parallel at runtime.
- Created an evidence-first interface connecting findings to exact screenplay lines.
- Produced an original controlled fixture containing plausible facts and intentional anachronisms.
- Correctly extracted and classified all 13 of 13 gold historical concepts in the latest controlled live evaluation, with zero research failures.
- Completed a separate hosted verification run with 14 findings, 14 real Parallel searches, 27 authoritative citations, and zero failures.
- Added reproducible tests, evaluation traces, source-quality checks, citation validation, cost limits, and safe failure behavior.
These results describe our controlled evaluation corpus rather than a claim of universal accuracy.
What we learned
The largest lesson was that agent reliability improves when generation and validation are separated.
Gemini is effective at extracting claims, planning research, and interpreting evidence. Deterministic application code is better suited to owning identity, provenance, resource limits, citations, and acceptance rules.
We also learned that uncertainty is a valuable product result. A historical research assistant should distinguish between “false” and “not yet proven.” Showing uncertainty tells the writer where human investigation is still needed without pretending that the evidence is stronger than it is.
Finally, evaluation fixtures were essential. Instead of relying on an impressive-looking demonstration, we created an original 1985 screenplay containing both valid period details and planted anachronisms, together with a machine-readable answer key.
What's next for Period Check
Next, we would add persistent job storage, private studio workspaces, longer screenplay support, collaborative comments, configurable source policies, and evaluation fixtures covering more eras and locations.
The same evidence pipeline could eventually support production researchers, prop departments, costume teams, art departments, and historical continuity reviews throughout pre-production.
Built With
- css
- document-ai
- fastapi
- gemini-2.5-flash-on-vertex-ai
- google-adk
- google-cloud-run
- html
- javascript
- parallel-search-api
- pydantic
- python
- secret-manager

Log in or sign up for Devpost to join the conversation.