TLDR: Traj-CoA is a novel multi-agent AI system designed to predict lung cancer risk by effectively processing long and noisy electronic health records (EHRs). It uses a “chain-of-agents” where worker agents process EHR data in chunks, distilling key events into a shared memory (EHRMem). A manager agent then synthesizes this information for prediction. This approach allows Traj-CoA to overcome limitations of traditional LLMs in temporal reasoning over extensive patient histories, demonstrating superior performance in zero-shot lung cancer risk prediction.
Understanding a patient’s health journey over time is crucial for predicting future health outcomes, especially for complex diseases like lung cancer. Electronic Health Records (EHRs) contain a wealth of information, but they are often incredibly long, spanning years, and filled with noisy, heterogeneous data. This presents a significant challenge for even the most advanced Large Language Models (LLMs), which often struggle with temporal reasoning over such extensive and complex inputs.
Researchers have introduced a new framework called Traj-CoA (Patient Trajectory Modeling via Chain-of-Agents) to tackle these challenges. This innovative system employs a multi-agent approach, where different AI agents work together in a chain to process and understand patient trajectories for lung cancer risk prediction.
How Traj-CoA Works
Traj-CoA is designed to overcome the limitations of traditional LLMs by breaking down the complex task of analyzing long and noisy EHR data into manageable steps. It consists of several key components:
Data Preprocessing: The first step involves converting a patient’s entire multimodal EHR history into a unified XML format. This structured format is easier for LLMs to comprehend. To handle the sheer volume of data, a ‘time-aware chunking’ strategy is used. Instead of simply cutting the data into fixed-size pieces, it intelligently partitions the XML input into segments based on timestamps, ensuring that all information within a chunk is closely related in time and preserving chronological order.
Chain-of-Agents: The core of Traj-CoA is its chain-of-agents architecture. This involves:
- Worker Agents: A series of specialized worker agents sequentially process each chunk of the EHR data. Each agent takes a chunk, along with a task-specific instruction and a summary from the previous agent, to extract critical, task-related information. This sequential processing allows for the progressive aggregation of information across the entire patient history.
- EHRMem (Long-Term Memory): To prevent important early clinical events from being ‘forgotten’ as worker agents process subsequent chunks, Traj-CoA incorporates a structured long-term memory module called EHRMem. Worker agents extract new clinical events or risk factors and store them here, along with their timestamps. A deduplication mechanism ensures that only new, unrecorded information is added, effectively reducing noise and preserving a comprehensive timeline.
- Manager Agent: After all worker agents have processed their respective chunks, a final manager agent synthesizes the comprehensive summary from the last worker agent and the entire timeline stored in EHRMem. This manager agent then makes the final prediction, leveraging a holistic view of the patient’s journey.
Performance and Insights
Traj-CoA was evaluated on a zero-shot one-year lung cancer risk prediction task, using five years of EHR data. The results showed that Traj-CoA significantly outperformed various baseline models, including traditional machine learning, deep learning, BERT-based models, vanilla LLMs, and Retrieval-Augmented Generation (RAG) approaches. Notably, while standard LLMs often struggle and degrade in performance with very long contexts, Traj-CoA’s performance actually improved as the context window expanded, demonstrating its unique ability to leverage ultra-long patient histories up to 160,000 tokens.
An important finding from the study was the crucial role of EHRMem. When this memory component was removed, the model’s performance dropped significantly, highlighting that maintaining a detailed long-term memory of clinical events is vital for accurate predictions.
Further analysis revealed that Traj-CoA’s reasoning is clinically aligned. It identifies salient events from diverse categories like diagnoses, symptoms, lab tests, and health behaviors. The model effectively reasons over the entire time horizon of the patient’s record, not just recent events, and the themes it identifies (such as advanced age, anemia, COPD, smoking history, and lung nodules) are consistent with established clinical knowledge for lung cancer risk assessment.
Also Read:
- MedCoAct: Enhancing Clinical Decisions Through Collaborative AI Agents
- Intelligent Agents Reshape Radiology Workflows
Looking Ahead
Traj-CoA represents a significant step forward in patient trajectory modeling, bridging the gap between generalist AI agents and the complex temporal reasoning required for longitudinal EHR data. While promising, future work will focus on enhancing its performance through more powerful base models, external knowledge integration, and broader validation across diverse clinical settings and prediction targets. To learn more about this innovative research, you can read the full paper here: Traj-CoA Research Paper.


