Inspiration

Health misinformation is a serious problem. When people search for answers about medications, supplements, or symptoms they often find contradictory articles, unvetted blog posts, and sponsored content. Primary care appointments are short, leaving little time for the kind of evidence-based Q&A many patients need.

We wanted to build something that could help: an AI assistant that retrieves real medical sources, shows its work, and never invents facts to fill the gaps.

When we discovered the You.com API ecosystem (Search, Contents, and Advanced Agents), we saw a practical foundation for the idea. It offers live web retrieval, content extraction from authoritative pages, and a reasoning agent that can synthesize evidence into a structured report. Remedy was built around those three APIs.

What it does

Remedy is a health research assistant that takes a natural language health question and returns a structured, source-backed report.

Research Agent

Every research query runs through a multi-step pipeline:

  1. Plan. The question is classified locally (drug interaction, supplement, wellness, or general health) using keyword matching, and 2 to 4 targeted search queries are generated from that classification.
  2. Search. Each query is sent to the You.com Search API, retrieving results from medical and health sources such as NIH, Mayo Clinic, PubMed, FDA, and WebMD.
  3. Read. Up to 3 of the top URLs, prioritizing authoritative domains, are passed to the You.com Contents API, which returns cleaned markdown from each page.
  4. Reason. The extracted content is assembled into a context prompt and sent to the You.com Advanced Agents API with the research tool for synthesis and analysis.
  5. Report. The agent's markdown response is parsed to produce a structured report covering safety rating, evidence level, key points, pros and cons, mechanism, recommendations, contraindications, and ranked citations.

Each step streams to the browser via Server-Sent Events (SSE), so users can watch the pipeline progress in real time rather than waiting for a spinner.

Additional Features

  • Goals. Users can track personal health goals. For each goal, the app searches You.com for relevant guidance and extracts highlighted tips from the top result pages.
  • News. Users can browse health headlines by category (Medical, Fitness, Diet, Wellness) using You.com Search in news mode. Optional AI summaries are generated via the Agents API when requested.
  • Events. Users can discover upcoming health and wellness events sourced from live You.com Search results.
  • Live and Offline Mode. Users can toggle between live You.com API calls and locally cached data. When offline, no API calls are made. The refresh interval (30 min, 1 hr, 2 hr, or 4 hr) is configurable per session.
  • Source Tier Badges. Each citation is assigned a tier based on its domain and content: FDA label, PubMed/RCT, meta-analysis/systematic review, observational/clinical site, or general content.
  • Risk Score. A 0 to 100 score is derived from the safety rating, evidence quality, and citation count. It uses a lookup table where higher base scores reflect more serious safety signals, adjusted up or down by evidence strength and citation volume.

How we built it

Frontend

The UI is built with Next.js 16 (App Router) and React 19, styled with Tailwind CSS v4 for dark and light theming, and Framer Motion for animations on the logo, step timeline, and modals. Report content is rendered via react-markdown with remark-gfm.

Backend (API Routes)

Each feature maps to a Next.js API route:

Route You.com APIs Purpose
/api/research Search, Contents, Agents Full research pipeline via SSE
/api/news/full Search, Agents (optional) News articles with optional AI summary
/api/goals Search, Contents Goal tips extracted from search results
/api/events Search Upcoming health and wellness events

You.com Integration

The intelligence layer rests on three You.com APIs:

  • Search API (GET /v1/search). Used for medical query retrieval with freshness, livecrawl, and count controls.
  • Contents API (POST /v1/contents). Extracts clean markdown from medical URLs to build the reasoning context.
  • Advanced Agents API (POST /v1/agents/runs). A reasoning agent with the research tool, used for report synthesis and optional news summaries.

Prompt Engineering

Prompts in prompts.ts instruct the agent to respond in a fixed set of markdown sections: Safety Assessment, Key Points, Potential Benefits, Risks and Considerations, How It Works, Recommendations, Contraindication Alerts (if applicable), Conflicting Evidence (if applicable), and Questions for Your Doctor. The parser reads this markdown structure to populate the report UI. The prompts explicitly prohibit raw URLs, redirect text, and navigation fragments in the output.

Fallback Analysis

If the Agents API times out or returns an empty response, a local fallback (buildSmartAnalysis) assembles a report directly from the search snippets and extracted content. Sentences are filtered for readability and classified as pros, cons, or key points using keyword matching. The UI makes it clear when this path is taken.

Caching and State

A localStorage cache (api-cache.ts) stores responses per resource type with configurable TTLs. This powers the offline mode: cached data up to 7 days old is displayed when the app is in offline mode. A dedicated OnlineModeContext manages the live/offline state and the per-session refresh interval.

Authentication is client-side via localStorage by design. The hackathon scope prioritized the AI research experience over a production auth backend.

Challenges we ran into

1. Streaming a multi-step pipeline

Making five distinct async steps stream to the browser as a unified real-time experience required careful SSE framing. Each step needed to emit intermediate state without closing the stream prematurely, and the frontend had to reconstruct pipeline state incrementally from partial chunks.

2. Getting clean output from the agent

Getting the You.com Advanced Agents API to return readable, well-structured markdown across diverse health queries required significant prompt iteration. We had to explicitly filter out URL fragments, redirect text, navigation noise, and "medically reviewed by" metadata that appeared in crawled content. We also built a sanitizeAnalysisMarkdown function to strip junk lines from the final output before rendering.

3. Source quality stratification

Search results do not come pre-labeled with evidence tiers. We built a heuristic source tier classifier that maps domains and URL patterns to a ranked taxonomy (FDA, PubMed/RCT, meta-analysis, observational/clinical, general), which feeds into the risk score and is displayed visually with SourceTierBadge. The risk score uses a lookup table with a base score per safety level (for example, "danger" maps to 85 and "safe" maps to 18), adjusted by evidence quality (strong evidence subtracts 12 points) and citation count (8 or more citations subtract another 5 points).

4. Offline and online state coherence

Keeping the UI coherent across Live and Offline modes, with configurable TTLs, stale-while-revalidate semantics, and graceful fallback, required more state management complexity than initially expected. We ended up with a dedicated OnlineModeContext and a cache layer that treats offline data as a first-class concern rather than an afterthought.

5. Preventing medical hallucination

Every design decision was filtered through one question: does this risk inventing medical facts? We chose not to surface mock or degraded data when API credits were unavailable, showing a clear error instead. When the agent fallback path is used, we note it explicitly in the report. We also include a persistent disclaimer bar and evidence-level indicators to reinforce that Remedy is a research assistant, not a doctor.

Accomplishments that we're proud of

  • Real-time pipeline transparency. Users watch the search, read, and reasoning steps happen in real time. Research is not a black box.
  • Citation-first design. Every claim in a report links back to a named, tiered source. No conclusion is shown without the evidence behind it.
  • Evidence tier system. A heuristic classifier meaningfully differentiates FDA guidance from a general wellness article, and the tier is surfaced visually in every report.
  • Honest fallback behavior. The pipeline handles API timeouts, partial outputs, and offline mode without fabricating data. When the agent fails, the fallback is labeled as such.
  • Polished UI shipped during the hackathon. The interface is dark/light themed, fully responsive, and animated, with streaming research output, collapsible sections, and a medical safety banner.

What we learned

  • Agentic pipelines need strict output templates. The most important engineering work was not the API calls themselves but the prompt template and the parser. Loose prompts produce readable prose that breaks the renderer.
  • Retrieval quality matters more than model quality. Giving the agent clean, domain-specific markdown from authoritative URLs via the Contents API produced better reports than relying on raw snippets alone.
  • SSE is underrated for AI UX. Streaming intermediate pipeline steps transforms the experience from waiting for a spinner to watching a process unfold. The uncertainty of a long API call is much easier to tolerate when users can see progress.
  • Offline-first is a feature, not a fallback. Building the cache layer as a first-class concern let us ship a genuinely usable offline mode rather than a broken one.
  • Medical AI demands epistemic humility. Every UI element, including safety banners, evidence levels, and disclaimer bars, exists because the design of an AI health tool is itself a safety decision.

What's next for Remedy - AI Health Research Agent

  • Personalized interaction profiles. Allow users to input their current medications and health conditions so the agent can flag personalized drug-supplement interactions rather than only population-level risks.
  • PubMed and ClinicalTrials.gov direct integration. Query structured biomedical databases directly for RCT-level evidence, beyond general web search.
  • Report history. Store full research reports with timestamps so users can track how evidence on a topic changes over time.
  • Shareable reports. Generate a public, read-only link for any report so users can share findings with their doctors or family members.
  • Clinician mode. A denser view with raw citations and confidence intervals for healthcare professionals.
  • Production authentication. Replace the localStorage-based demo auth with a proper backend such as NextAuth with a database for persistent, secure user accounts.
  • Multi-language support. Expand access to non-English speakers using You.com's multilingual retrieval capabilities.

Built With

Share this project:

Updates