AI Agents for Drug Interaction Screening: An API-First Approach
How AI agents can use FDA-approved drug interaction text and RxNorm enrichment to screen medication lists — with working code and architecture patterns.

Every year, adverse drug interactions contribute to an estimated 125,000 deaths and 1.3 million emergency department visits in the United States alone. The data to prevent many of these interactions already exists — buried in FDA-approved drug labels that few systems read programmatically.
Today we're releasing the DDI Reference API, a new endpoint that gives AI agents and applications direct access to FDA-approved drug interaction text, enriched with RxNorm drug classification data. This post walks through why this matters for AI-powered medication safety, how to build an agent workflow around it, and what's coming next.
The Problem: Interaction Data Is Scattered
FDA drug labels contain detailed, authoritative interaction text — CYP enzyme inhibition, additive hypotension risks, monitoring requirements. But this data is locked in unstructured label sections spread across 250,000+ SPL documents. Commercial DDI databases exist, but they're expensive, proprietary, and opaque about their evidence sources.
For AI systems, this creates a grounding problem. An LLM can reason about drug interactions, but without access to authoritative source text, its output is unverifiable. You get a black box answering questions about patient safety — the exact scenario where provenance matters most.
What the DDI Reference API Provides
The API composes two existing data sources into a single call:
- FDA Label Sections —
drug_interactions, warnings, contraindications, boxed_warning, pharmacokinetics
- RxNorm Enrichment — ingredients, drug classes (MoA, PE, EPC), substance names, and DailyMed links
Given a list of drug identifiers (RxCUI, NDC, or FDA set_id), the API returns the full interaction text from each drug's FDA label alongside structured drug metadata. Every response includes a DailyMed URL so clinicians can verify the source.
curl -X POST https://api.fhirfly.io/v1/ddi/reference \
-H "x-api-key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"drugs": ["261962", "197361"]}'
This returns interaction sections for ramipril (an ACE inhibitor) and amlodipine (a calcium channel blocker), along with their drug classes, ingredients, and label metadata.
Building an Agent Workflow
The real power of this API is what happens when you combine it with an LLM agent. Here's an architecture pattern we've seen work well:
Step 1: Extract the Medication List
Your agent receives a medication list — from an EHR integration, a patient intake form, or a FHIR MedicationRequest bundle. Map each medication to an RxCUI using the RxNorm API.
Step 2: Fetch Interaction Profiles
Send all RxCUIs to the DDI Reference API in a single batch call. You get back each drug's FDA interaction text, drug classes, and ingredients in one response.
import { FhirflyClient } from '@fhirfly-io/terminology';
const client = new FhirflyClient({ apiKey: process.env.FHIRFLY_KEY });
// Batch lookup — up to 25 drugs per request
const result = await client.ddi.referenceMany(
['261962', '197361', '11289'],
{ sections: ['contraindications'] }
);
// Each drug has: interaction text, drug classes, ingredients, DailyMed link
for (const drug of result.drugs) {
if (drug.status === 'ok') {
console.log(drug.drug.generic_name, drug.label.sections.drug_interactions);
}
}
Step 3: LLM-Powered Analysis
Pass the interaction text to your LLM as grounded context. The agent now reasons over FDA-approved text rather than parametric knowledge. A well-structured prompt might look like:
Given these FDA-approved drug interaction sections for the patient's medications,
identify any potential interactions. For each interaction found:
1. Which drugs are involved
2. The mechanism (from the label text)
3. Clinical significance
4. Recommended monitoring or dose adjustments
5. The DailyMed URL for verification
Drug interaction profiles:
{ddi_reference_results}
Because the LLM is working from FDA label text, its reasoning is auditable. A pharmacist can click the DailyMed link and verify every claim the agent makes.
Step 4: Structured Output
The agent produces structured findings that can feed into clinical decision support, pharmacy workflows, or patient-facing summaries. Drug class data (MoA, PE, EPC) from RxNorm helps the agent identify mechanism-based risks — for example, flagging that two drugs both decrease renal potassium excretion.
Why Drug Classes Matter for AI Reasoning
One of the most useful fields in the DDI response is drug_classes. These come from NLM's MED-RT and categorize drugs by:
- MoA (Mechanism of Action) — e.g., "Angiotensin-converting Enzyme Inhibitors"
- PE (Physiologic Effect) — e.g., "Decreased Blood Pressure", "Decreased Renal K+ Excretion"
- EPC (Established Pharmacologic Class) — FDA's official class designation
For an AI agent, drug classes are a powerful signal for identifying interactions the FDA label might not explicitly enumerate. If two drugs share the physiologic effect "Decreased Blood Pressure," the agent can flag additive hypotension risk even if neither label mentions the other drug by name. This is especially valuable for newer medications where label interaction sections haven't been updated to reflect all possible combinations.
MCP Integration: Claude Desktop as a Drug Interaction Tool
The DDI Reference API is also available as an MCP tool (check_drug_interactions) in the FHIRfly MCP Server. This means Claude Desktop can screen medication lists directly:
"Check the interactions between ramipril 10mg, amlodipine 5mg, and warfarin 5mg"
Claude fetches the FDA interaction profiles, analyzes the text, and presents findings with source links — all within the conversation. For clinical informaticists prototyping DDI workflows, this is the fastest path from question to grounded answer.
Key Takeaways
- FDA labels are the authoritative source for drug interaction data in the U.S. The DDI Reference API makes this text programmatically accessible with a single API call.
- AI agents need grounded context for medication safety. Parametric knowledge isn't auditable — FDA label text is.
- Drug class metadata enables reasoning beyond explicit label mentions. MoA and PE classifications help agents identify mechanism-based interaction risks.
- Batch lookups keep agent workflows fast. Send up to 25 drugs per request, get back interaction profiles with DailyMed links for verification.
- Provenance is non-negotiable. Every response includes the SPL ID, set ID, and DailyMed URL so clinicians can verify the source.
What's Next: Phase 2
The DDI Reference API ships what we're calling Tier 1 — surfacing authoritative FDA text with structured metadata. But we're already working on Tier 2: structured DDI pair analysis.
Phase 2 will introduce pairwise interaction extraction — given two drugs, the API will return not just the raw label text, but structured interaction records with severity classifications, clinical effects, and evidence quality indicators derived from the FDA text. Think of it as moving from "here's what the label says" to "here's what the label says about this specific combination."
If you're building clinical decision support or medication safety tooling and want early access to Phase 2, reach out — we'd love to shape it around real use cases.
Drug interaction data is sourced from FDA-approved labeling via DailyMed and NLM RxNorm. This is reference information only and does not constitute medical advice. Always consult qualified healthcare professionals for drug interaction decisions.