Overview
EHRAgent uses generate→execute→parse-error→refine cycles with domain metadata and memory to improve multi-hop schema linking; effective empirically but depends on a capable base LLM and incurs extra runtime/API calls.
Citations2
Evidence Strength0.70
Confidence0.90
Risk Signals13
Trust Signals
Findings with numeric evidence: 3/3
Findings with evidence refs: 3/3
Results with explicit delta: 1/4
Reproducibility
Status: Code + data available
Open source: Partial
At A Glance
Cost impact: 50%
Production readiness: 60%
Novelty: 60%
Why It Matters For Business
EHRAgent reduces dependence on data engineers by letting clinicians ask EHR questions in plain language and getting accurate answers; this can speed workflows but increases runtime/API calls and needs privacy safeguards.
Who Should Care
Summary TLDR
EHRAgent is a code-centric LLM agent that answers complex, multi-table EHR queries by generating Python plans, executing them, and iteratively debugging using parsed error traces and a small memory of past successful examples. It injects query-specific medical metadata, dynamically selects four relevant few-shot examples from long-term memory, and uses a 'rubber duck' error-explainer to guide fixes. On three real EHR benchmarks (MIMIC-III, eICU, TREQS) it raises success rate vs prior best baselines (same tools and prompts) by up to 29.6 percentage points on evaluated datasets, while requiring only four demonstrations.
Problem Statement
Clinicians need ad hoc, multi-step data from large relational EHRs but rely on data engineers. Off-the-shelf LLMs struggle with multi-table schema linking, domain specifics, and iterative debugging. EHRAgent reframes EHR QA as code-based planning plus execution feedback to let an LLM autonomously generate, run, and refine queries.
Main Contribution
An LLM agent that produces executable Python plans to solve few-shot multi-table EHR questions.
Query-specific medical information injection to improve schema linking and table/column discovery.
Key Findings
EHRAgent substantially improves EHR multi-table QA success rates versus prior LLM agent baselines.
Interactive coding (code generation + execution feedback) is the largest single contributor to performance.
Results
| Metric | Value | Baseline | Delta | Split / Dataset | Evidence | Evidence Ref |
|---|---|---|---|---|---|---|
| Success rate (MIMIC-III, overall) | 58.97% | — | — | MIMIC-III (all complexities) | EHRAgent overall success rate on MIMIC-III | Table 1 |
| Success rate (eICU, overall) | 53.10% | — | — | eICU (all complexities) | EHRAgent overall success rate on eICU | Table 1 |
What To Try In 7 Days
Run a small prototype: wire a Python-based toolset (DB loader, SQLInterpreter) to an LLM and test 10 real queries.
Add EHR metadata injection (table/column descriptions) and 4 curated examples to your prompt; compare success vs plain prompts.
Implement a simple error parser that returns error type, location, and candidate causes to the LLM and measure iteration gains.
Agent Features
Memory
Planning
Tool Use
Frameworks
Is Agentic
Yes
Architectures
Collaboration
Optimization Features
Token Efficiency
Reproducibility
Code URLs
Risks & Boundaries
Limitations
Requires multiple LLM calls per query which increases cost and latency.
Relies on closed-box models (GPT-4) in experiments; behavior may differ for open LLMs.
When Not To Use
For unsupervised, high-stakes clinical decisions without human review.
If strict cost or latency budgets forbid multiple LLM calls per query.
Failure Modes
Date/time miscalculations (uses system dates incorrectly)
Context-length truncation leading to missing info

