Weekend Warrior Project: AI Patent Checking
- By Bruce Nielson
- ML & AI Specialist
Ever had an idea and wondered, “Wait… has someone already patented this?” At Mindfire Tech, we recently faced that exact problem. We were working on an AI patent, and before we could go any further, we needed to know if the concept was already patented.
Sure, we could have spent hours — maybe days — digging through USPTO records, manually reading abstracts, and trying to make sense of hundreds of documents. Or… we could let AI do it for us.
One weekend later, we had a fully functioning AI Patent Search agent. In a few hours, we built a tool where you just paste in your patent abstract (or the full patent!), and it will:
- Generate intelligent search queries.
- Search the USPTO patent database automatically.
- Refine queries if there are too many or too few results.
- Retrieve abstracts and documents.
- Rank the results by relevance.
All you have to do is review the final top results — the agent does the rest. The funniest part? Writing the AI agent was far easier than trying to do this work manually. Instead of getting lost in endless PDFs and XML files, we spent the weekend building a tool that could save weeks of research for anyone working on patents.
It’s the kind of “weekend warrior” project that feels like magic: a fully functional AI agent built in a single weekend, solving a problem that used to take days. At Mindfire, that’s exactly the kind of creative, high-impact AI work we love doing for our clients.

How It Works: The Tech Behind the Magic
While the AI agent feels seamless, there’s a lot going on under the hood. Here’s a breakdown of the technologies that make this possible:
1. Gradio for a Clean, Instant UI
We used Gradio, a Python library, to create a web interface in minutes.
- Textbox for your patent idea
- Dropdown to select an AI model
- Button to trigger the search
- Expandable previews of retrieved patents
All interactive, all local — no frontend frameworks, no headaches.
2. Local LLMs with Ollama
All AI reasoning happens locally using Ollama.
- Models like Gemma, Llama, and Mistral run right on your machine
- No data leaves your system — perfect for confidential IP
- Fast enough to generate search queries and semantic rankings in seconds
We used Ollama as the backbone for our AI agent, orchestrated with DSPy.
3. DSPy: Structured AI Orchestration
DSPy provides the “brains” of the agent:
- Generates structured queries from your patent idea
- Refines queries if the first pass fails
- Scores patents for relevance using their abstracts
DSPy enforces strict input/output formats, which keeps the AI’s predictions consistent and reliable. It’s what turns a raw LLM into a real research assistant.
4. Multi-Stage Patent Retrieval
The agent searches the USPTO using our Python wrapper for their API:
- Submits structured keyword queries
- Filters only granted patents
- Fetches up to hundreds of results per query
If a query returns zero or too many results, the agent automatically refines it.
5. FlashRank Reranking
Once we have raw results, we use FlashRank, a fast CPU-based reranker:
- Scores patents by relevance to your idea
- Works without GPUs or PyTorch
- Reduces hundreds of results to the most relevant top candidates
This ensures you only see what really matters.
6. Full Patent Document Retrieval
For the top patents, the agent fetches the full XML from the USPTO:
- Extracts abstracts with
lxml - Prepares server-side previews for your review
- Keeps everything local and ready for the next step
No more opening PDFs one by one — the agent handles the tedious part.
7. Semantic Reranking with LLMs
Finally, the agent uses the LLM again to read and rank abstracts semantically:
- Scores each abstract 0–1 for relevance
- Sorts patents so the top few are the ones you actually care about
- Provides a concise, actionable list of results, including the actual abstracts.
This makes the final output feel like a real research assistant — not just a search engine.
The Result
In a single weekend, we created an agent that:
- Understands your patent idea
- Queries official government databases
- Retrieves, parses, and ranks hundreds of patents
- Presents a clean, interactive review interface
It’s fast, reliable, and ready to save anyone hours of manual research.
AI Patent Search Agent Pipeline

The diagram above shows how the agent flows from idea input to semantic scoring, highlighting all the key stages of retrieval, refinement, and ranking.
Why Mindfire Can Help
Building an AI prototype in a weekend is fun — but imagine what our team can do with more time and your unique business challenges.
At Mindfire Tech, we specialize in:
- Custom AI agents for research and analysis
- Automation that saves weeks of manual work
- Secure, locally hosted AI solutions for sensitive projects
If you’re curious about how AI can transform your workflows — patent research or beyond — we’d love to talk.
After all, if we can build a full patent search agent in a weekend, imagine what we could build for your business.