Pharma

Research Patent Cliff Competitive Intelligence

In this example, we built an app that uses a Nimble Web Search Agent to search the web for medicines nearing patent expiry and return a cited report on FDA approvals, legal dockets, pricing signals, manufacturer response, and near-term patent events.

Quick Start

Inputs

  1. Medicine list A plain-language list of medicines and patent-expiry context entered in the browser.
  2. Optional JSON or CSV list A reusable medicine list passed to the CLI with DRUG_LIST_PATH; entries can include name, expiry, and notes, and the app wraps the file in the same standing research brief the browser uses.
  3. Research brief The default brief asks for FDA approvals, court dockets, pricing, manufacturer responses, and patent events in the next 24 months, adaptable to another therapeutic area.
  4. Server-side configuration NIMBLE_API_KEY and NIMBLE_AGENT_ID for the research itself, plus one model-provider key for the single Vercel AI SDK call that starts each run.

Outputs

  • A Nimble research run ID returned immediately, without holding the browser request open
  • An in-progress state that resumes after a browser refresh in the same session, and a finished report that survives a refresh too
  • Per-medicine findings on biosimilar and generic approvals, docket activity, pricing, manufacturer response, and upcoming patent events
  • A final report with source links, whether the agent is configured for prose or structured JSON output
  • Nimble confidence metadata, including confidence level, cited-claim count, and source count

How it works

A 6-step asynchronous research pipeline.

  1. Define the research task The user enters medicines and patent-expiry context in the browser, or supplies a JSON or CSV list to the CLI; either path is wrapped in the same standing research brief.
  2. Start Nimble research The Next.js API route calls Vercel AI SDK generateText() pinned to Nimble's nimbleAgentStartRun() connector tool, which starts the Web Search Agent run and returns a run handle.
  3. Keep only the run handle in the browser The UI stores the returned runId in sessionStorage, while NIMBLE_API_KEY and the Nimble Agent ID stay server-side.
  4. Poll for the result The browser calls the same API route every five seconds; the server invokes nimbleAgentRunResult() directly with no model in the loop, returning the active state until the run completes.
  5. Render cited findings The app renders the finished markdown report with Nimble's trust metadata (confidence, cited-claim count, and source links), linking each [n] callout to its cited source via trust.claims[].callout.
  6. Resume without reconstructing context A refresh in the same session resumes an in-progress run or restores a finished one, and the CLI can retrieve any report later from its task_run_... handle.

Stack

Nimble primitives plus the full runtime stack.
Nimble APIs
What it does
  1. Web Search Agent A pre-created wsa_... agent instance performs the long-running, source-backed patent-cliff research.
  2. @nimble-way/ai-sdk Nimble's Vercel AI SDK connector, registering nimbleAgentStartRun(), nimbleAgentRunStatus(), and nimbleAgentRunResult() as AI SDK tools that every call to Nimble goes through.
  3. Nimble trust metadata Supplies the confidence level, cited-claim count, and source list rendered with a completed report.
3rd Party Tools
Role
  1. Vercel AI SDK v6 + OpenAI provider Runs a server-side agent that starts each research run with one forced tool call, on gpt-5-nano by default and swappable for any AI SDK provider.
  2. Next.js 16 App Router UI and the Node.js API route that starts and polls runs, with a 60-second ceiling since it never waits for the full research job.
  3. React 19 + react-markdown Renders browser input, progress state, session persistence, and the markdown report with linked citation callouts.
  4. TypeScript Typed server, client, and CLI implementation across the app.
Reach out if you have any questions.
Talk to an Expert