How to automate medication reconciliation with AI Agents

Up to 40% of medication errors happen during care transitions. Learn how to build AI agents for medication reconciliation using Corti's Agentic Framework, with built-in drug intelligence, clinical guardrails, and full auditability.

TLDR

Medication reconciliation compares a patient's medication list against current orders at care transitions like admission, transfer, and discharge, to catch errors, duplications, and interactions. Up to 40% of medication errors happen during these transitions. AI agents on Corti can automate medication reconciliation, with built-in governance and auditability.

Up to 40% of medication errors happen during care transitions. About one in five of those cause harm.

The task sounds simple: list everything a patient takes, compare it against current orders, flag problems. In practice, the data lives in multiple systems. Patients forget to mention OTC medications. Pharmacy records contradict the EHR. A pharmacist has to piece it all together under time pressure, usually across phone calls and fax machines.

Consider a patient with diabetes, hypertension, and chronic kidney disease who gets admitted with conflicting medication lists from two specialists. Her pharmacy records don't match her EHR. She's been taking an OTC NSAID she didn't bring up, and it interacts with her other drugs. One missed step and she's on a dangerous combination.

This is a multi-source, conditional reasoning problem with real consequences. It's also the kind of work agents are good at.

Building a medication reconciliation agent on Corti

Corti's Agentic Framework gives healthcare developers infrastructure for workflows like this. Orchestration, guardrails, auditability, and compliance are built into the framework itself.

1. Start with the Medication Reconciliation Agent template

The Agent Library includes a Medication Reconciliation Agent that reviews medications against clinical records. It ships with specialized Experts (modular AI components for tasks like drug database lookups, dosage calculations, and clinical knowledge retrieval). You can deploy it directly or customize it.

Pre-Configured Medication Reconciliation Agent on the Corti Agentic Framework

2. Combine reasoning with domain expertise

The framework runs a multi-agent architecture. An orchestrator coordinates Experts, each with tightly scoped domain intelligence. For medication reconciliation, you'd configure your agent to use the DrugBank Expert for drug intelligence, the Medical Calculator Expert for dose calculations, a Web Search Expert for current clinical guidance, and custom Experts you build via MCP to connect your EHR or pharmacy systems.

The orchestrator validates each action and keeps a full audit trail. It pulls from trusted sources instead of guessing.

3. Define the workflow and context

You configure the agent's system prompt to lay out the reconciliation workflow: collect data from EHR medication lists, pharmacy records, and patient interviews. Normalize drug terminology. Compare lists. Flag discrepancies. Produce a reconciled output.

Each request includes patient context, including structured FHIR medication resources, so the agent works with real clinical data at runtime.

The output is a reconciliation summary with discrepancy flags and documentation gaps that need clinician review.

Sample output from Corti's Medication Reconciliation Agent, showing a full reconciliation summary with discrepancy flags and documentation gaps requiring clinician clarification.

4. Deploy with built-in governance

Corti agents run under a central orchestrator that validates actions, enforces execution rules, and stops agents from acting outside their scope. Every decision and tool invocation gets logged with replayable traces. Agents can pause for human approval when needed.

5. Integrate and iterate

Use the Corti Console to authenticate, create your agent, configure its Experts, and test. The framework supports the Agent-to-Agent (A2A) spec for interoperability and MCP for connecting to compatible systems. Start with a prototype for one part of reconciliation and extend from there.

The SDK is available for Node.js and browser environments. Full API docs at docs.corti.ai.

import { CortiClient, CortiEnvironment } from "@corti/sdk";

const client = new CortiClient({
  environment: CortiEnvironment.Eu,
  auth: {
    clientId: "YOUR_CLIENT_ID",
    clientSecret: "YOUR_CLIENT_SECRET"
  },
  tenantName: "YOUR_TENANT_NAME"
});

// Send patient context and medication data
const response = await client.agents.messageSend(agentId, {
  message: {
    role: "user",
    parts: [{
      kind: "text",
      text: "Reconcile medications for this patient at admission"
    }],
    messageId: crypto.randomUUID(),
    kind: "message"
  }
});

Why agents?

You can't solve medication reconciliation with a single prompt. The task has variable inputs, conditional logic, data from multiple systems, and clinical judgment baked into every step. Agents let you encode that reasoning into a governed, auditable system that actually works in production.

Explore the Agentic Framework docs, browse the Agent Library, and start building.

More stories from Corti

View all

Join our mission

We believe everyone should have access to medical expertise, no matter where they are.