GxP-Agent: Process-DAG Topology for Reliable Clinical Trial Programming with LLM Agents
06:00 · August 19, 2026 · arXiv cs.AI RSS

Clinical trial programming -- transforming study protocols into analysis-ready datasets under CDISC standards -- is a bottleneck in regulatory submissions, yet LLM-based code generation fails catastrophically on this task: across 11 single-shot attempts with five frontier models, none produces a valid subject-level analysis dataset. We introduce GxP-Agent, a multi-agent system that encodes regulatory process ordering as a directed acyclic graph (DAG), decomposing monolithic dataset generation into 15 domain-specific nodes executed by worker agents with pharmaverse skill context, validation gates, and conditional retry. On CDISC-Bench, a new execution-based benchmark built from the FDA pilot submission CDISCPilot01 (254 subjects, 49 ground-truth ADSL variables), GxP-Agent with Claude Sonnet 4.6 achieves 100% structural match (49/49 variables, 254 correct records) across three independent runs, compared to 59.2% for the best retrieval-augmented baseline and 0% for all single-agent and flat multi-agent approaches. The DAG topology also enables weaker models: GPT-4.1 achieves 59.2% mean structural match under the same DAG, where it scores 0% under every other architecture. The approach generalizes to ADAE (adverse events; 9-node branching DAG, 55 variables, 1,191 records), achieving 100% structural match on the first attempt. These results demonstrate that encoding domain process knowledge as graph topology -- rather than relying on LLM reasoning alone -- is a key enabler for reliable, GxP-compliant clinical trial programming.
Summary
Clinical trial programming requires transforming raw study data into analysis-ready datasets that meet CDISC ADaM standards, a step that remains a major bottleneck for regulatory submissions. Single-shot LLM generation consistently fails on this task: across eleven attempts with five frontier models, none produced a valid subject-level analysis dataset (ADSL), with errors ranging from hallucinated variable names and function signatures to incorrect file references and logic faults.
GxP-Agent addresses the problem by encoding the known regulatory process ordering as a directed acyclic graph. A project-manager agent selects a pre-defined DAG template, which a compiler translates into a LangGraph StateGraph. Each of the fifteen nodes for ADSL generation is executed by a specialized worker agent equipped with pharmaverse R-package context, schema introspection, and tools for code execution and file management. Validation gates enforce record-level, variable-level, and business-rule assertions after critical steps, while conditional retry routes failures back to the same node with error traces appended.
On CDISC-Bench, constructed from the FDA’s public CDISCPilot01 submission (254 subjects, 49 ground-truth ADSL variables), the system using Claude Sonnet 4.6 reached 100 percent structural match across three independent runs. The same DAG topology lifted GPT-4.1 from zero percent under single-shot or flat multi-agent setups to 59.2 percent mean structural match. The approach generalizes to the adverse-event dataset ADAE, where a nine-node branching DAG produced a 100 percent structural match on the first attempt.
These outcomes indicate that, in domains where process dependencies are known in advance, supplying that structure as explicit agent topology yields more reliable, auditable results than relying on LLM-driven decomposition alone.
Why it matters
Directly applicable to Dutch/EU pharma and biotech SMEs needing GxP-compliant AI automation; aligns with Netherlands emphasis on ethical, transparent, and auditable AI under EU AI Act and regulatory standards.








