[New Publication in JAMIA Open] THESEUS: An AI Agent for Automating Executable Strategus R Scripts from Free-Text Study Designs

Hi all,

I wanted to share a paper our group just published in JAMIA Open

The practical problem was a familiar one — translating a conceptual target trial emulation (TTE) study design into reproducible R code requires deep OHDSI-specific technical expertise. It’s a major bottleneck for many researchers.

To solve this, we developed THESEUS, an LLM-powered AI agent that automates R coding for observational research. The key here is the clear division of labor: the AI agent handles the cognitive task of reasoning and structuring natural language descriptions into standardized JSON specifications, while a deterministic rule-based logic takes over to generate the actual, error-free Strategus R scripts.

We evaluated this agentic workflow by feeding it actual text descriptions from previously published papers (both OHDSI and non-OHDSI). The AI agent successfully replicated the original study designs with up to 95-97% accuracy.

Instead of letting an AI loosely write open-ended code from scratch, pairing the AI agent with a standardized infrastructure (OMOP CDM & Strategus) is what makes autonomous code generation safe and reliable for clinical pipelines. It has now been integrated into OHDSI’s ongoing Study Agent initiative.

THESUS also has a dedicated web app.

Chan

5 Likes