ConceptioArchivearXiv CS
arXiv CSopen access

SpaCellAgent: A Self-Evolving LLM-Based Multi-Agent Framework for Trajectory Analysis

Unknown · 2026 · arxiv_cs
arXiv CS · Papers · License: Open Access · 2026
Open Source ↗Direct PDF ↓
artificialintelligenceknowledgerepresentationreasoning
artificial intelligence, reasoning, knowledge representation

arXiv:2607.07467v1 [cs.AI] 8 Jul 2026

SpaCellAgent: A Self-Evolving LLM-Based Multi-Agent Framework for Trajectory Analysis Songhan Wang∗

Haoang Chi†

He Li

[email protected] University of Shanghai for Science and Technology Shanghai, China

[email protected] National University of Defense Technology Changsha, China

[email protected] Hong Kong Baptist University Kowloon, Hong Kong National University of Defense Technology Changsha, China

Zhiheng Zhang

Jiayan Yuan∗

Cheems Wang

[email protected] Shanghai University of Finance and Economics Shanghai, China

[email protected] University of Shanghai for Science and Technology Shanghai, China

[email protected] Tsinghua University Beijing, China

Hao Peng

Xinwang Liu

Wenjing Yang†

[email protected] Beihang University Beijing, China

[email protected] National University of Defense Technology Changsha, China

[email protected] National University of Defense Technology Changsha, China

Abstract Spatial and Single-cell transcriptomics are transformative in deciphering cellular dynamics. As the fundamental paradigm for reconstructing cell developmental paths, trajectory inference (TI) is critical. However, existing methods require extensive manual intervention and proficiency in heterogeneous tools, posing a significant barrier to efficient TI analysis. To bridge this gap, we propose SpaCellAgent, an autonomous large language model (LLM) multi-agent framework that automates end-to-end spatiotemporal analysis and narrative generation. SpaCellAgent utilizes a multi-agent architecture for strategic workflow planning, a dynamic tool-orchestration engine for adaptive algorithm selection, and a self-evolution module that iteratively refines performance through feedback. We evaluate SpaCellAgent on six heterogeneous datasets encompassing complex temporal developmental trajectories, diverse sequencing platforms, and spatially-resolved tissue architectures. SpaCellAgent consistently demonstrates over 40% improvement in analytical efficiency while maintaining expert-aligned performance. By converting natural language specifications into optimized analytical workflows and fully automating the pipeline, SpaCellAgent democratizes advanced spatiotemporal modeling and establishes a scalable, agent-driven ∗ Equal contribution. † Corresponding author.

This work is licensed under a Creative Commons Attribution 4.0 International License. KDD 2026, Jeju Island, Republic of Korea. © 2026 Copyright held by the owner/author(s). ACM ISBN 979-8-4007-2259-2/2026/08 https://doi.org/10.1145/3770855.3818914

paradigm for computational biology. The code and materials are available at https://github.com/LittleXH-shw/SpaCellAgent.

CCS Concepts • Computing methodologies → Multi-agent systems; • Applied computing → Bioinformatics; Transcriptomics.

Keywords Trajectory Inference, Spatial Transcriptomics, scRNA-seq, Large Language Models, Multi-Agent Systems ACM Reference Format: Songhan Wang, Haoang Chi, He Li, Zhiheng Zhang, Jiayan Yuan, Cheems Wang, Hao Peng, Xinwang Liu, and Wenjing Yang. 2026. SpaCellAgent: A Self-Evolving LLM-Based Multi-Agent Framework for Trajectory Analysis. In Proceedings of the 32nd ACM SIGKDD Conference on Knowledge Discovery and Data Mining V.2 (KDD 2026), August 9–13, 2026, Jeju Island, Republic of Korea. ACM, New York, NY, USA, 27 pages. https://doi.org/10.1145/3770855. 3818914

1

Introduction

Single-cell RNA sequencing (scRNA-seq) has revolutionized our understanding of cellular diversity and developmental processes by enabling transcriptome profiling at individual cell resolution [36]. This technology captures the heterogeneity within cell populations [37], revealing rare cell types [34], transitional states [38], and dynamic expression patterns that were previously obscured in bulk measurements [22]. Recently, the rapid development of spatial transcriptomics technologies has enabled the preservation of gene expression with spatial coordinates, allowing the mapping of cellular states within their native tissue architectures [6, 30]. These approaches provide unprecedented insights into how cellular states

KDD 2026, August 9–13, 2026, Jeju Island, Republic of Korea.

Songhan Wang et al.

SpaCellAgent Workflow Conduct TI analysis with this dataset

Automatic Standard Plan

User Input Low-barrier User-friendly

Self-evolving and Refinement

Traditional Workflow

Executor Intelligent Tool Selection & Execution

Planner

LLMs

Evaluator

Reporter

Efficient and Insightful Analytics

User

Manual Plan

Heterogeneous Tools

Steep Learning Inconsistency Distinct Platforms Curve Non-standardized Learning Costs

Analyses Inefficiency Expert-driven

Figure 1: Comparison between SpaCellAgent and the traditional workflow. Our framework utilizes an LLM-driven multi-agent system to autonomously translate natural language queries and spatial data into biological insights. By orchestrating code generation and execution, it replaces complex, non-standardized traditional workflows with a streamlined, automated pipeline. evolve both temporally and spatially [33], offering a comprehensive view of developmental trajectories [25], disease mechanisms [24], and tissue homeostasis [28, 32]. However, systematically uncovering molecular mechanisms from such high-dimensional cellular states necessitates intricate analysis pipelines [16]. Within this methodological landscape, Trajectory Inference (TI) stands out as a pivotal instrument for investigating cellular development and inferring cell fate, effectively reconstructing the continuous progression of biological processes from static snapshots [4]. To operationalize cellular development trajectory analysis, a diverse array of computational approaches has been established, including Monocle [27], PAGA [41], Slingshot [35], and Diffusion Pseudotime (DPT) [15]. These methods are grounded in distinct mathematical frameworks, ranging from graph-based algorithms to principal curve fitting and diffusion maps, to infer cellular ordering and branching structures. However, despite their theoretical advancements, these methods exhibit inconsistent performance across varying data dimensionalities and trajectory topologies [31], thereby necessitating manual selection and heuristic tuning by domain experts. Recent advances in large language models (LLMs) have catalyzed a paradigm shift from manual tool-centric analysis to autonomous LLMs agent-driven exploration [3, 40]. Beyond code generation and complex reasoning [1, 14], LLMs can now orchestrate heterogeneous computational tools and democratize scientific interpretation by bridging raw outputs with meaningful insights [12, 21]. Despite this transformative potential, the integration of LLMs agent workflows into single-cell lineage reconstruction remains nascent, lacking an end-to-end closed-loop solution. Crucially, existing approaches lack automated mechanisms for self-evolution and iterative refinement; their static nature often yields suboptimal inference results and imposes a prohibitive manual burden. Consequently, there is an imperative for a unified framework that leverages the biological reasoning abilities of pre-trained LLMs as a cognitive core, autonomously orchestrating TI workflows. To fill these gaps, we introduce SpaCellAgent, an autonomous LLM-driven framework that performs end-to-end spatial analysis and biological narrative generation. In contrast to traditional static and rigidly defined pipelines [2, 39], SpaCellAgent introduces a collaborative multi-agent architecture that dynamically assigns specialized roles, such as planner, executor, evaluator, and reporter, to each LLM. Specifically, the planner analyzes trajectory analysis

objectives and topological data properties to decompose the lineage reconstruction process into executable milestones, while the executor autonomously identifies optimal algorithmic strategies through a dynamic tool orchestration engine to generate robust implementation code. The evaluator assesses the quality of the reconstructed lineage, diagnosing specific TI anomalies such as implausible branching and pseudotime inversion, while synthesizing corrective feedback for iterative improvement through a self-refinement mechanism. Additionally, SpaCellAgent incorporates a self-evolution module that persistently accumulates reusable error fixes and validated analysis templates across tasks, enabling continuous improvement and knowledge accumulation. Extensive benchmarking demonstrates that SpaCellAgent outperforms stateof-the-art (SOTA) baselines in topological fidelity while reducing the analysis time by 41.2%. Crucially, it reconciles scalability with robustness, delivering stable, expert-aligned trajectory analysis performance. In general, the main contributions of this work can be summarized as follows: • We propose SpaCellAgent, an autonomous multi-agent framework that performs end-to-end TI analysis by integrating scRNA-seq and spatial transcriptomics data, and generates interpretable biological reports derived from the TI results and other downstream analyses. • SpaCellAgent couples data-driven strategy selection with a self-evolving refinement mechanism, enabling the system to autonomously adapt to diverse biological heterogeneities while continuously accumulating knowledge to optimize analysis robustness. • Extensive experiments demonstrate SpaCellAgent’s expertaligned performance, and its 41.2% improvement in analytical efficiency compared to manual expert workflows. Therefore, our SpaCellAgent drastically shortens the timeto-insight for complex trajectory analysis.

2 Related Work 2.1 Trajectory Analysis in Single-Cell and Spatial Omics The computational reconstruction of cellular developmental trajectories has evolved through distinct methodological paradigms [4, 31]. In the realm of scRNA-seq, foundational tools established

SpaCellAgent: A Self-Evolving LLM-Based Multi-Agent Framework for Trajectory Analysis

the premise of ordering cells along a latent pseudotime [15]. Monocle pioneered this approach using minimum spanning trees (MST) and reversed graph embedding to resolve branching lineages [27]. Slingshot introduced principal curves for stable multi-lineage inference [35], while PAGA utilized graph abstraction to effectively reconcile clustering with trajectory topology [41]. The advent of spatial transcriptomics has catalyzed a paradigm shift in developmental modeling, necessitating the integration of physical topology into lineage reconstruction. Recent frameworks, such as SpaceFlow [29] and STORIES [17], have extended TI by incorporating spatial neighborhood constraints to model tissue-scale gene expression gradients. Despite these methodological strides, the existing TI landscape remains fragmented and heavily reliant on manual expertise. Researchers are often constrained by heterogeneous computational ecosystems, necessitating experience-dependent method choice and inefficient manual exploration of the hyperparameter space. This lack of standardization not only hampers reproducibility but also creates a prohibitive barrier for domain scientists. To address these challenges, we propose SpaCellAgent, an LLM-driven agentic framework that autonomously orchestrates adaptive algorithm selection and iterative code refinement, ensuring robust and reproducible analysis across diverse biological contexts.

2.2

LLM and Agent Systems for Scientific Discovery

The advent of LLMs, such as Gemini 2.5 [11], has led to a paradigm shift in code generation, natural language reasoning, and complex task decomposition. Building on these capabilities, general-purpose multi-agent architectures, such as ChatDev [26], have demonstrated how specialized agents can collaborate to autonomously execute intricate software engineering tasks. Recently, this agent-driven paradigm has notably extended to physics, where frameworks like ChemCrow [21] have successfully demonstrated the efficacy of LLMs in automating material property prediction and orchestrating chemical synthesis. However, in biomedicine and bioinformatics, the adoption of such workflows has been predominantly limited to textual tasks, such as literature retrieval and hypothesis formulation [23, 43]. The potential for driving closed-loop, empirical data analysis, particularly for multi-step computational biology workflows, remains largely underexplored. Existing LLM agent frameworks, primarily optimized for general-purpose software engineering or text processing, lack the domain-specific abilities for biological data analysis. Specifically, they do not support the autonomous orchestration of heterogeneous TI analysis algorithms, nor do they possess the error-recovery mechanisms necessary for processing high-dimensional, noisy omics data. To date, a unified framework capable of executing end-to-end, closed-loop trajectory analysis tasks remains absent. Our SpaCellAgent fills this gap by establishing an LLM-driven autonomous framework that dynamically optimizes algorithmic selection, delivering end-to-end TI analysis through a robust, self-optimizing workflow.

KDD 2026, August 9–13, 2026, Jeju Island, Republic of Korea.

3 Preliminary 3.1 Trajectory Inference Analysis in Cellular Data Formally, let a single-cell dataset be denoted as 𝐷 = {X, S}. The gene expression profile is represented by a matrix X ∈ R𝑁 ×𝐺 , where 𝑁 denotes the number of cells and 𝐺 represents the number of genes. Each row x𝑖 ∈ R𝐺 corresponds to the high-dimensional expression vector of cell 𝑖. In the context of spatial transcriptomics, each cell is additionally associated with a spatial coordinate vector s𝑖 ∈ R𝐷 (typically 𝐷 = 2 for tissue sections), forming a spatial coordinate matrix S ∈ R𝑁 ×𝐷 . A common and advantageous approach is to model cellular relationships as a graph 𝐺 = (𝑉 , 𝐸), with nodes 𝑉 representing cells. The adjacency matrix A ∈ 0, 1𝑁 ×𝑁 is constructed based on pairwise transcriptomic similarity for scRNA-seq data. For spatial transcriptomics, it is built by integrating the expression matrix with physical coordinates, enabling the capture of the local manifold structure. The primary objective of TI is to reconstruct a dynamic developmental process from these static snapshots. Mathematically, this can be formulated as learning a mapping 𝑓 : (X, S) → T , that projects the high-dimensional data onto a low-dimensional latent manifold T , which represents the continuous space of all possible cell states along the process. Crucially, the inference of T is operationally realized by jointly determining: (1) Pseudotime Ordering (𝝉): A continuous scalar value 𝜏𝑖 ∈ [0, 1] that assigns each cell a coordinate on the manifold T , representing its progression level. for each cell 𝑖, representing its progression level along the biological process, where 𝜏 = 0 denotes the root state and 𝜏 = 1 denotes the terminal state. (2) Lineage Structure: A connectivity graph or a set of principal curves describing the global topology (e.g., linear, bifurcating, or tree-structured) of cell fate decisions. In spatial-aware TI, the inferred pseudotime 𝝉 must be smooth with respect to both the transcriptomic manifold X and the spatial graph defined by S.

3.2

LLM-driven Autonomous Agents

LLM-driven autonomous agents represent a paradigm shift in which LLMs serve as the “brain” for planning, reasoning, and action execution. While the individual agent demonstrates impressive capabilities in task decomposition, it is prone to instability in complex scenarios. Consequently, recent research focuses on multi-agent collaboration, which mimics human group dynamics by assigning distinct roles to specialized agents. By facilitating inter-agent interaction and iterative feedback, this collaborative architecture overcomes the limitations of a single agent, offering superior robustness and accuracy for handling sophisticated workflows such as computational biology tasks.

4 Method 4.1 Framework Overview In this section, we introduce the overview of the SpaCellAgent. As shown in Figure 2, SpaCellAgent is an autonomous, LLM-driven framework designed to organize complex trajectory analysis on single-cell and spatial transcriptomics data. Distinct from static code

KDD 2026, August 9–13, 2026, Jeju Island, Republic of Korea.

User Input Conduct TI analysis with this mouse midbrain spatial transcriptomic Midbrain dataset. data

Self-evolution

Memory

Verified Code Registered Tools Current Plans

Self-refinement

LLM Agent

Songhan Wang et al.

Evaluator

Planner

Executor

•Primary objective: TI analysis •Data type: Spatial transcriptomics •Analytical goal: Understanding cell developmental dynamics

Based on the current steps and data, I will generate and execute the code.

I will evaluate the current results and provide recommendations.

Tool Selector

Data structure: 1.shape: (26738, 24045) 2.spatial context: yes 3.Sparsity:97.5% Step: 1 tool selection: scanpy

Error_type: Workflow Order Error Description: ... Suggestion: ...

Coder

Tool: scanpy Step: 1 Number of attempts:1 evaluator suggestion: ...

Initiating automated trajectory inference analysis with default optimal settings as follows:

Step1: Data loading and structure identification Step2: Data preprocessing Step3: Batch correction Step4: Cell Type Annotation Step5: DEG Identification Step6: Spatially Variable Genes Identification Step7: TI analysis Step8: Plots and report

# (B) Filtering sc.pp.filter_cells(adata, min_genes=200) sc.pp.filter_genes(adata, min_cells=3) adata = adata[ adata.obs.pct_counts_mt < 20, :]

Code Evaluator

Biological evaluation:

Biological Evaluator

Reporter Summary report

1.Dataset: Midbrain_data (26738, 24045) 2. Biological Insight: Trajectory successfully reconstructs the differentiation lineage from RGCs → NeuBs or GlioBs. 3. Key Driver Genes: Sox2, Neurog2, Nfia. 4. Enrichment: NeuB Branch: Axonogenesis, synapse assembly, nervous system development. …

Plots

1. Main plots in subset E16.5:

The identification of retinal ganglion cells (RGCs) at the terminal point of the trajectory is biologically implausible. Suggestion: ...

I will summarize the evaluator's suggestion, and optimize the code.

Umap

TI

Figure 2: The framework of SpaCellAgent. The planner decomposes user queries into executable steps for the executor, while the evaluator enforces dual verification for syntactic and biological validity. The reporter then synthesizes the final biological insights. Arrows are color-coded: blue (input for planner), orange (input for executor), and green (evaluator’s feedback for self-refinement and self-evolution). Validated plans are archived in dual-layer memory to drive self-evolution. generation tools, our frameworks implement a dynamic, closedloop workflow powered by multi-agent collaboration. Upon receiving a natural language task description, the system initiates a collaborative process involving distinct agent roles. This process encompasses data perception, where input characteristics are inspected; strategic planning, where optimal TI and downstream analysis methods are selected; and autonomous execution, where executable Python or R scripts are generated and verified. The workflow culminates in the generation of a comprehensive report, integrating visual outputs with biological interpretation, thereby streamlining the path from raw data to scientific hypothesis formulation.

4.2

Agent Roles and Functionalities

Planner agent. The planner agent acts as the system’s reasoning engine, decomposing high-level user intents into executable logics. It accepts a dual input: the natural language query and a structured metadata profile of the target dataset, encompassing gene expression counts, sparsity patterns, and spatial modalities. Leveraging an LLM with specialized planning instructions, the agent synthesizes a directed action sequence encoded in a JSON file. Each node in this sequence is assigned a unique ID and a descriptive label, establishing a machine-readable backbone that facilitates robust downstream execution and human-in-the-loop verification. Executor agent. The executor agent bridges the gap between abstract planning and concrete execution. It consists of two tightly coupled components responsible for dynamic tool retrieval and context-aware code generation. Tool selector. This component functions as a semantic router, mapping high-level task descriptions to specific computational tools. It queries a curated registry containing both standard single-cell methods and spatial-aware algorithms. By utilizing an LLM conditioned on the dataset characteristics and user requirements, the tool selector dynamically configures the analysis pipeline, avoiding

the drawbacks of static default settings and ensuring compatibility with the data’s intrinsic spatiotemporal structure. Coder. The Coder functions as a specialized implementer, synthesizing executable scripts to instantiate abstract TI methods into runnable workflows. Leveraging a polyglot architecture, it flexibly interfaces with optimal tools across the Python and R ecosystems to resolve complex lineage topologies. The generation process adheres to rigorous constraints, managing the serialization of single-cell objects and ensuring the seamless flow of pseudotime and trajectory coordinates between heterogeneous analysis environments. Evaluator agent. The evaluator agent enforces a rigorous quality control protocol through a dual-layer validation mechanism comprising a code evaluator for execution integrity and a biological evaluator for scientific plausibility. Code evaluator. This component constitutes the foundational verification stage, specifically tasked with guaranteeing the integrity of TI workflows. It systematically inspects execution logs for algorithm-specific failures and verifies the existence of output files. If runtime exceptions are detected, the component extracts the error context and routes it as actionable debugging feedback to the executor. This enables the system to autonomously attempt code correction, explicitly skipping the biological validation phase to optimize token usage. Biological evaluator. The biological evaluator moves beyond syntax to assess the biological fidelity of the inferred trajectories. Ingesting the generated plots and statistical summaries, the agent utilizes LLMs to cross-reference the findings with established biological priors. It specifically targets common TI artifacts, such as biologically impossible lineage transitions or inverted developmental paths. For example, it checks alignment with the known cellular hierarchy, allowing it to flag biologically impossible transitions, such as erroneously assigning a terminally differentiated cell as the trajectory root. If such a discrepancy is detected, the biological

SpaCellAgent: A Self-Evolving LLM-Based Multi-Agent Framework for Trajectory Analysis

evaluator flags the result as biologically incoherent and provides a targeted diagnostic hypothesis, guiding the planner to refine the upstream configuration. Knowledge-augmented fallback mechanism. To enhance generalization to trajectory inference tasks outside the model’s experience distribution, we design a knowledge-augmented fallback mechanism integrated into the biological evaluator agent. Specifically, when SpaCellAgent encounters a trajectory inference task that falls outside its internal experience memory, the biological evaluator initiates an automated search through PubMed to retrieve the latest biological reference, including tissue-specific markers and similar case studies. This allows the agent to evaluate its TI results in peer-reviewed scientific evidence rather than heuristic guessing. Dynamic tool discovery and registration mechanism. To break through the boundaries of a predefined registry, SpaCellAgent is designed with a dynamic tool discovery and registration mechanism, enabling adaptive bioinformatics problem-solving. Specifically, if the agent determines that the existing tool registry is insufficient to execute the formulated plan, it will dynamically introduce and invoke new tools (e.g., importing a novel Python/R package for a specific spatial transcriptomics algorithm). Once the analysis incorporating the new tool successfully passes biological validation, SpaCellAgent will archive the successful analysis pipeline into the global memory and extract and register the newly utilized tool into the tool registry. Through this strategy, the tool registry autonomously expands and evolves by integrating novel tools and registering validated workflows. Dual-layer memory architecture. To ensure coherent reasoning across varying temporal scales, SpaCellAgent implements a hierarchical memory system comprising local and global modules. Local memory serves as an ephemeral, intra-task context buffer. It logs the full trajectory of the current analysis step, including iterative code drafts, execution traces, and diagnostic evaluations. This comprehensive history allows the coder to engage in context-aware debugging, preventing recursive errors during self-correction. In contrast, global memory serves as a persistent inter-task knowledge base. It consolidates successfully verified code snippets and reasoning patterns from historical runs. By retrieving relevant exemplars from this global repository, the agent enables knowledge transfer across different datasets, effectively bootstrapping new tasks with proven analytical templates. This dual capability equips it with greater adaptability and scalability when confronting the high heterogeneity and complex dependencies inherent in spatial and single-cell data.

4.3

Self-refinement and Self-evolution

Self-refinement mechanism. To ensure robustness in TI analysis, SpaCellAgent incorporates an autonomous self-refinement mechanism. For each step, the system initiates a bounded iterative process in which the evaluator assesses the execution output. Successful iterations commit to the intermediate dataset state and advance the workflow. In contrast, failures trigger a refinement cycle: the coder receives an augmented context containing the full interaction history, truncated error logs, and semantic feedback from the evaluator. Guided by prompts that enforce strategy divergence to avoid repetitive errors, the agent synthesizes revised code for re-execution.

KDD 2026, August 9–13, 2026, Jeju Island, Republic of Korea.

This loop persists until success is achieved or the maximum attempt limit is reached. By integrating rule-based error detection with LLM-driven diagnosis, this mechanism autonomously resolved syntax errors and API discrepancies encountered during trajectory analysis, enabling the seamless modeling of cellular dynamics. Cross-task self-evolution. Beyond within-task self-refinement, SpaCellAgent integrates a self-evolution mechanism for continual learning in TI analysis. This module treats successful TI workflows as reusable knowledge, archiving verified code snippets alongside biological contextual metadata into a global memory repository. Upon encountering new datasets, the coder queries this repository to retrieve relevant analysis templates, effectively utilizing a retrieval-augmented generation strategy to bias the model toward proven architectural patterns. Furthermore, the system accumulates error-fix pairs from historical failures, allowing it to proactively apply discovered remedies, such as parameter adjustments or alternative method selection, to recurrent issues. Over time, this cumulative knowledge base transforms SpaCellAgent into an adaptive system, progressively enhancing convergence speed, stability, and trajectory analysis consistency across diverse biological scenarios. Together, the self-refinement and self-evolution mechanisms transform SpaCellAgent from a static pipeline into a continuously improving system. As it is applied to more datasets and use cases, its internal knowledge base becomes richer, enabling superior generalization to unseen biological contexts and robust handling of complex lineage topologies over time.

5 Experiment 5.1 Setup Model configuration. In all reported experiments, the agents were instantiated using the DeepSeek-V3 model [14]. We accessed the model through API with the temperature set to 0.0 and the 𝑇𝑜𝑝-𝑝 set to 1 to prioritize precise and deterministic outputs. For the self-reflection task, we employed a slightly higher temperature of 0.4 (with 𝑇𝑜𝑝-𝑝 to 1), allowing the agent to explore alternative biological hypotheses when the initial path failed. Additionally, the maximum output token limit was set to 128,000 to accommodate long-sequence biological reasoning. Datasets. In this study, we employed a diverse set of six datasets comprising both synthetic and curated benchmarks (REAL-GOLD, REAL-SILVER, SYNTHETIC) [31], and real-world spatial tissues, such as the Mouse Dorsal Midbrain, Axolotl Neuron Regeneration [6], and an unpublished Mouse Spinal Cord Injury (SCI) Dataset. The details of the datasets are in Appendix B.1. These datasets provide comprehensive coverage of contexts essential for robust TI evaluation: maturation, cellular states, germline specification, technical variability, and spatial organization. Baselines. We compared SpaCellAgent with five established methods representing diverse algorithmic paradigms: • DPT [15]: A diffusion-based method that estimates pseudotime by simulating random walks on a transition matrix to resolve branching lineages. • RaceID/StemID [13]: A clustering-based framework that combines outlier-sensitive clustering with minimum spanning trees to identify lineage connectivity.

KDD 2026, August 9–13, 2026, Jeju Island, Republic of Korea.

Songhan Wang et al.

Table 1: Performance comparison with baseline methods on real and synthetic datasets. Bold indicates the best result, and underline indicates the second-best result. Real-Gold

Method

Real-Silver

Synthetic

Corr

HIM

WCor

F1

Corr

HIM

WCor

F1

Corr

HIM

WCor

F1

DPT RaceID/StemID Scorpius PAGA PAGA Tree Slingshot

0.213 0.220 0.295 0.256 0.319 0.347

0.515 0.334 0.576 0.469 0.523 0.651

0.385 0.501 0.551 0.735 0.478 0.749

0.262 0.206 0.139 0.402 0.440 0.483

0.259 0.288 0.602 0.431 0.442 0.469

0.387 0.389 0.569 0.497 0.614 0.551

0.413 0.501 0.719 0.680 0.670 0.639

0.279 0.206 0.574 0.381 0.519 0.541

0.308 0.361 0.455 0.470 0.501 0.448

0.483 0.381 0.431 0.539 0.605 0.431

0.323 0.562 0.525 0.649 0.664 0.445

0.345 0.128 0.436 0.358 0.439 0.421

SpacellAgent

0.480

0.710

0.711

0.608

0.774

0.322

0.719

0.645

0.564

0.560

0.660

0.509

UMAP_E16.5

Trajectory_E16.5

Spatial_E12.5

Spatial_E14.5

Spatial_E16.5

Figure 3: UMAP visualization and spatial distributions of cell types in the mouse embryonic dorsal midbrain at developmental stages E12.5, E14.5, and E16.5. • Scorpius [5]: A linear inference method that orders cells by projecting them onto a shortest-path curve derived from k-nearest neighbor distances. • PAGA [41]: A graph abstraction technique that preserves global topology by constructing a coarse-grained connectivity map between cell clusters, capable of capturing complex cyclic structures. • PAGA Tree [41]: A variant of PAGA optimized for hierarchical lineages, which directs the abstracted graph to generate a rooted, tree-like trajectory structure. • Slingshot [35]: A curve-fitting approach that employs semisupervised principal curves to model smooth, branching trajectories across pre-defined cluster centers. For all baselines, we adopt the default parameter settings as provided in their original implementations.

5.2

Evaluation Metrics

We employed four complementary metrics to assess SpaCellAgent from the perspectives of cellular ordering, branch assignment, biological feature relevance, and global network topology. Correlation. We calculated the Spearman rank correlation coefficient 𝜌 between the geodesic distance matrices of reference and predicted trajectories: Corr = 𝜌 (𝐷𝑟𝑒 𝑓 , 𝐷 𝑝𝑟𝑒𝑑 ).

(1)

This metric quantifies the preservation of global cellular relationships along the inferred milestone network. F1 Branches (F1). We used the Jaccard-based F1 score to evaluate structural correspondence: 𝐹 1𝑏𝑟𝑎𝑛𝑐ℎ = 2 ·

𝑅𝑒𝑐𝑜𝑣𝑒𝑟𝑦 · 𝑅𝑒𝑙𝑒𝑣𝑎𝑛𝑐𝑒 . 𝑅𝑒𝑐𝑜𝑣𝑒𝑟𝑦 + 𝑅𝑒𝑙𝑒𝑣𝑎𝑛𝑐𝑒

(2)

It assesses the model’s accuracy in capturing milestone branches and ensuring the purity of cell assignments to those branches. Feature importance weighted correlation (wCor). This metric evaluates the agent’s ability to identify key trajectory-driving genes. We performed Random Forest (RF) regression to extract gene importance vectors from the predicted coordinates: 𝑤𝐶𝑜𝑟 = corr𝑤 (FI𝑟𝑒 𝑓 , FI𝑝𝑟𝑒𝑑 ).

(3)

The Pearson correlation is weighted by reference importance to emphasize biologically significant drivers. Hamming-Ipsen-Mikhailov score (HIM). To compare the inferred milestone network G𝑝𝑟𝑒𝑑 with the ground truth G𝑟𝑒 𝑓 , we employed the HIM distance: √︃ 1 𝐻𝐼𝑀 = 1 − √ 𝑑𝐻2 + 𝑑𝐼2𝑀 , (4) 2 where 𝑑𝐻 represents normalized Hamming distance and 𝑑𝐼 𝑀 represents Ipsen-Mikhailov distances. For all metrics defined above, higher values consistently indicate superior performance.

SpaCellAgent: A Self-Evolving LLM-Based Multi-Agent Framework for Trajectory Analysis

5.3

Results

To evaluate the trajectory analysis capabilities of SpaCellAgent, we first evaluated both baselines and SpaCellAgent across three diverse benchmarks: REAL-GOLD, REAL-SILVER, and SYNTHETIC. The general results shown in Table 1 present a comprehensive performance comparison. Then, we conducted a comparison with LLM-based baselines. The details are provided in Appendix B.3. As shown in Table 1, SpaCellAgent achieves SOTA performance, ranking first in the majority of metrics across all datasets. Notably, on the REAL-GOLD dataset, SpaCellAgent outperforms the secondbest method, Slingshot, with an average Correlation of 0.480 and an F1 score of 0.608. This substantial improvement is attributed to the self-refinement and self-evolution mechanisms within SpaCellAgent, which autonomously mitigate errors arising from manual parameter tuning. In contrast to baseline methods constrained by static algorithmic assumptions, SpaCellAgent employs its LLMdriven planner and tool selector to perform dynamic data profiling. This mechanism empowers the agent to autonomously orchestrate the optimal configuration of analytical tools tailored to each specific dataset, thereby circumventing the drawbacks of human bias and manual optimization errors. Spatial trajectory analysis and biological insights. To further investigate the capability of SpaCellAgent in analyzing highdimensional data with spatial coordination, we applied SpaCellAgent to the Mouse Embryonic Dorsal Midbrain dataset. This dataset contains 26,738 spatially resolved cells from the mouse embryonic dorsal midbrain, with expression profiles for 24,045 genes and temporal information from stages E12.5, E14.5, and E16.5. Unlike dissociated single-cell data, this task requires the agent to reconcile gene expression similarity with physical proximity. As shown in Figure 4, SpaCellAgent autonomously orchestrated the data preprocessing and visualized the clustering landscape through UMAP. Critically, SpaCellAgent proactively inferred the latent developmental pathways and automatically generated trajectory plots based on its reasoning. These visualizations reveal that SpaCellAgent accurately reconstructed the bifurcation trajectory from Radial Glia-like (RGL) progenitors into distinct neuronal (NeuB) and glial (GlioB) lineages. This trajectory aligns with the temporal progression from E12.5 to E16.5, as illustrated in Figure 5, and is driven by a distinct shift in marker expression, transitioning from Sox2-positive progenitors to Nurr1- and Th-positive neurons. These results are consistent with prior studies [6, 18]. Subsequently, we conducted functional enrichment analysis, validating the biological plausibility of the identified lineage, highlighting key pathways such as axonogenesis and dopamine metabolic processes, which are intrinsic to midbrain development. Next, we applied SpaCellAgent to the Axolotl Neuron Regeneration dataset, another spatially resolved dataset capturing complex tissue reconstruction.

5.4

Case Study

To evaluate the generalization capability and real-world utility of SpaCellAgent, we deployed the framework on a private scRNA-seq dataset of Mouse SCI provided by our collaborating hospital. This dataset captures the impact of high-salt (HS) versus normal-salt (NS) intake across three specific time points: Day 0, Day 7, and Day 28. Specifically, time point day 0 denotes the Sham-operated (SAM)

KDD 2026, August 9–13, 2026, Jeju Island, Republic of Korea.

group, serving as the uninjured baseline control where the surgical procedure was performed without inducing spinal cord damage. SpaCellAgent first devised a TI analysis plan based on the structural characteristics of the data and user requirements, and designated the optimal analytical tool for each step of the workflow. Subsequently, SpaCellAgent executed the workflow according to the specified plan. Following the cell annotation step, it analyzed potential cell developmental trajectories within the SCI context based on the annotation results. Subsequently, SpaCellAgent executed the TI step, modeling the lineage progression from precursors to mature cells by constructing a pseudo-temporal ordering, as shown in Figure 4. SpaCellAgent further conducted temporal expression profiling, revealing that HS-OPCs persistently upregulated the inhibitor Sox17 even at late stages while failing to sustain Plp1. To quantify this developmental perturbation, SpaCellAgent further employed pseudotime analysis to dissect the underlying lineage dynamics. As shown in Figure 6, solid lines representing fitted expression trends along the differentiation pseudotime clearly reveal a premature termination of the HS trajectory and a significant expression gap in Plp1 compared to the NS lineage. The results reveal that, by integrating velocity-derived streamlines with fate probability calculations, the agent autonomously identified a marked differentiation blockade in the HS group. Unlike the continuous NS trajectory, the HS lineage exhibited fragmented streamlines and early-stage cell arrest, indicating impaired endogenous remyelination. These findings are consistent with prior studies highlighting the detrimental impact of high-salt diets on post-injury neural recovery [19, 42]. These results substantiate SpaCellAgent’s capacity for autonomous hypothesis formulation in unseen biological contexts, proving its practical utility as a powerful assistant for accelerating novel scientific discoveries. Then, we conducted an enrichment analysis to quantitatively validate the biological fidelity. The details are provided in Appendix B.3.

6

Ablation Studies

To verify the effectiveness of SpaCellAgent’s components, we conducted ablation studies with the following variants: (1) SpaCellAgent w/o planner; (2) SpaCellAgent w/o evaluator; (3) SpaCellAgent w/o self-evolution (w/o Evol.); (4) GPT-4 (w/o agent); (5) w/o experience memory. Effectiveness analysis. We first conducted ablation experiments on the REAL-GOLD benchmark, alongside the Mouse Embryonic Dorsal Midbrain and Axolotl Neuron Regeneration Datasets. For this analysis, we defined a standardized TI workflow comprising six tasks and measured the Task Success Rate (TSR) to compare different variants. The results given in Figure 7 show the necessity of the full multi-agent architecture. Specifically, GPT-4 exhibits the poorest performance, primarily due to its inability to manage the intricate context of long-horizon TI workflows, which often results in code generation failures. Regarding the architectural variants, the w/o planner variant suffers from a lack of strategic direction, leading to failures in decomposing complex biological goals into actionable sub-tasks. Similarly, the w/o evaluator variant operates without the critical self-correction mechanism, rendering it incapable of resolving runtime errors or refining suboptimal outputs,

KDD 2026, August 9–13, 2026, Jeju Island, Republic of Korea.

Songhan Wang et al.

Cell tpye

Trajectory_HS

UMAP2

Trajectory_NS

1.0 0.6 0.3 0.0

UMAP1

Figure 4: UMAP projection of cell type clusters identified by SpaCellAgent and comparison of inferred developmental trajectories between Homeostatic (HS) and Nerve Injury (NS) conditions.

E12.5

3

E16.5 30.51%

82.47%

2

RGC 32.98% 15.46% NeuB GlioB

NS HS

NeuB

RGC

Expression Level

E14.5

1 0 1

18.96%

GlioB

2

2.06%

Figure 5: Sankey diagram illustrating the temporal lineage transitions and cell fate proportions across the three embryonic stages.

0.0

0.2

0.4

0.6

Pseudotime (Differentiation)

0.8

1.0

Figure 6: Pseudotime expression kinetics of the marker gene Plp1, showing differential differentiation trends between HS and NS groups. Solid lines represent the fitted expression trends along the differentiation pseudotime.

Record · ID 349673 · SHA-256 33f686d2db103c9b
Retrieved via Conceptio — every document is proof-bundled with source, license, and retrieval metadata.