Conceptio › Archive › arXiv CS
arXiv CS open access

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

2026 · arxiv_cs
arXiv CS · Papers · 2026
Open Source ↗Direct PDF ↓
artificial-intelligenceknowledge-representationreasoning
Conceptio Open Archive

Analyze & explore related research in Conceptio

Connect this record directly into your research workflow or AI agent. Explore citations across open repositories, query full text, and export structured proof bundles.

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

243352479@st.usst.edu.cn University of Shanghai for Science and Technology Shanghai, China

haoangchi618@gmail.com National University of Defense Technology Changsha, China

lihemaster117@gmail.com Hong Kong Baptist University Kowloon, Hong Kong National University of Defense Technology Changsha, China

Zhiheng Zhang

Jiayan Yuan∗

Cheems Wang

zhangzhiheng@mail.shufe.edu.cn Shanghai University of Finance and Economics Shanghai, China

242482685@st.usst.edu.cn University of Shanghai for Science and Technology Shanghai, China

cheemswang@mail.tsinghua.edu.cn Tsinghua University Beijing, China

Hao Peng

Xinwang Liu

Wenjing Yang†

penghao@buaa.edu.cn Beihang University Beijing, China

xinwangliu@nudt.edu.cn National University of Defense Technology Changsha, China

wenjing.yang@nudt.edu.cn 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. 



7DVN6XFFHVV5DWH 765

which significantly undermines overall robustness compared to the SpaCellAgent framework. Efficiency analysis. To evaluate efficiency, we recruited five domain experts actively engaged in bioinformatics research (spanning Master’s and Ph.D. levels) to establish an averaged human baseline. The details of experts team are provided in Appendix B.7. Then, we benchmarked SpaCellAgent against the human baseline and the variant w/o self-evolution. As shown in Table 2, SpaCellAgent recorded the lowest total execution time of 38.0 minutes, outperforming the human average by 41.2% and the non-evolutionary baseline by 32.7%. Gains were most significant in complex downstream tasks, with SpaCellAgent surpassing human experts by 53.6% in Step 4 and 63.9% in Step 5. While humans slightly lead in initial preprocessing, the self-evolution mechanism minimizes redundant debugging in later stages, ensuring superior scalability for end-to-end analysis. Collectively, these results demonstrate that SpaCellAgent significantly alleviates the manual burden of complex trajectory inference, offering a scalable and time-efficient paradigm for high-throughput biological hypothesis formulation.

 *37 ZR3ODQQHU ZR(YDOXDWRU 6SD&HOO$JHQW 2XUV

   

6WHS

6WHS

6WHS

$QDO\VLV6WHSV

6WHS

6WHS

Figure 7: The results of operational effectiveness analysis. Cross-Model sensitivity analysis. To demonstrate our framework’s robustness, we conducted additional sensitivity experiments using GPT-5.2 and claude-sonnet-4-6 as alternative foundational

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

Table 2: Efficiency comparison, time cost in minutes.

Task

Human Expert

w/o Evol.

SpaCellAgent

Step1 Step2 Step3 Step4 Step5

10.0 ± 1.6 8.4 ± 1.2 11.2 ± 2.0 8.4 ± 1.2 26.6 ± 3.8

15.4 ± 1.2 6.8 ± 2.0 8.8 ± 0.8 11.0 ± 1.2 14.5 ± 1.5

12.4 ± 0.8 6.5 ± 1.4 5.6 ± 0.6 3.9 ± 0.7 9.6 ± 0.9

64.6

56.5

38.0

Total Time

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

Table 4: Tool selection consistency of the three real-world datasets. Dataset

Midbrain

Axolotl

SCI

Step1 Step2 Step3 Step4 Step5

1.0 1.0 1.0 1.0 0.9

1.0 1.0 1.0 1.0 0.8

1.0 1.0 1.0 1.0 1.0

8.0 ± 0.7

7.8 ± 0.4

7.2 ± 0.8

Quality score

Table 3: Sensitivity comparison with different LLMs.

7

Dataset

We introduce SpaCellAgent, an autonomous self-evolving LLMbased multi-agent framework for trajectory analysis. By integrating a collaborative multi-agent architecture with dynamic tool orchestration, SpaCellAgent plans workflows, selects methods, executes analyses, and generates interpretable reports, closing the gap between raw data and biological insight. The results of the experiment confirm that the SpaCellAgent matches the performance of the experts while reducing the analysis time by more than 40% and lowering the accessibility barrier for the domain researchers. Ablation studies validate the critical roles of agent-based decomposition, iterative self-refinement, and knowledge reuse across tasks in achieving robustness and stability. Future work will extend the SpaCellAgent to spatial multi-omics integration and tighter coupling with regulatory network analysis, positioning SpaCellAgent as a foundational step toward scalable, intelligent assistants in computational biology.

Deepseek-V3

GPT-5.2

claude-sonnet-4-6

S1 S2 S3 S4 S5

0.526 0.615 0.571 0.483 0.755

0.538 0.613 0.570 0.494 0.768

0.518 0.624 0.582 0.481 0.768

SR

0.8

0.9

0.9

models. We experimented with five subsets from the real gold benchmark and calculated Spearman’s rank correlation. Meanwhile, we conducted an effectiveness analysis on complex real-world datasets for 10 runs and calculated the success rate (SR). The results of these cross-model comparisons are shown in Table 3. The results show consistent gains in both efficiency and accuracy, confirming that the performance is driven by our agentic framework design. Tool selection consistency analysis. To evaluate the tool selection consistency and planning accuracy of SpaCellAgent, we conducted systematic experiments of potential issues such as tool selection errors and agent planning failures. Specifically, we repeated the same analysis task 5 times independently on each of the three real-world datasets: the Mouse Dorsal Midbrain (Midbrain), Axolotl Neuron Regeneration (Axolotl), and SCI (with the same input and the temperature set to 0). We measured the tool selection consistency of each dataset. Meanwhile, we invited a human expert team to evaluate the planning accuracy and feasibility (use a quality score rated on a scale from 0 to 10). We implemented a standardized TI workflow as defined in our effectiveness analysis, measuring the consistency rate across all repeated trials. Subsequently, we invited the human expert team to independently evaluate the accuracy and feasibility of the generated analysis plans and each step of the code. The results are shown in Table 4. The result shows that our framework achieves consistently high tool selection reliability and planning accuracy across all three datasets, confirming that the standardized workflow effectively mitigates tool selection errors and planning failures. To quantitatively verify the effectiveness of the Knowledgeaugmented fallback mechanism, we conduct an additional ablation study with the w/o experience memory variants on the real-gold dataset. The details are provided in Appendix B.8.

Conclusion

Acknowledgments This work was partially supported by the National Natural Science Foundation of China (Grant No. 62525213, 62372459, 62325604), the Beijing Natural Science Foundation (Grant No. L253021), and the Innovative Research Group Project of Hunan Province (Grant No. 2025JJ10008).

Limitations and Ethical Considerations All authors adhere to all ACM Publications Policies, including ACM’s Publications Policy on Research Involving Human Participants and Subjects. The regulatory mechanisms inferred by SpaCellAgent, while computationally robust and consistent with established literature, remain hypotheses that warrant future validation through in vivo experimental assays. All datasets utilized in this study were acquired and processed in strict adherence to ethical guidelines and privacy regulations.

GenAI Disclosure In this work, we mainly employ GenAI to identify and correct syntax errors and polish writing.

References [1] Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, et al. 2023. Gpt-4 technical report. arXiv preprint arXiv:2303.08774 (2023).

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

[2] Rhonda Bacher and Christina Kendziorski. 2016. Design and computational analysis of single-cell RNA-sequencing experiments. Genome biology 17, 1 (2016), 63. [3] Daniil A Boiko, Robert MacKnight, Ben Kline, and Gabe Gomes. 2023. Autonomous chemical research with large language models. Nature 624, 7992 (2023), 570–578. [4] Robrecht Cannoodt, Wouter Saelens, and Yvan Saeys. 2016. Computational methods for trajectory inference from single-cell transcriptomics. European journal of immunology 46, 11 (2016), 2496–2506. [5] Robrecht Cannoodt, Wouter Saelens, Dorine Sichien, Simon Tavernier, Sophie Janssens, Martin Guilliams, Bart Lambrecht, Katleen De Preter, and Yvan Saeys. 2016. SCORPIUS improves trajectory inference and identifies novel modules in dendritic cell development. biorxiv (2016), 079509. [6] Ao Chen, Sha Liao, Mengnan Cheng, Kailong Ma, Liang Wu, Yiwei Lai, Xiaojie Qiu, Jin Yang, Jiangshan Xu, Shijie Hao, et al. 2022. Spatiotemporal transcriptomic atlas of mouse organogenesis using DNA nanoball-patterned arrays. Cell 185, 10 (2022), 1777–1792. [7] Haoang Chi, He Li, Wenjing Yang, Feng Liu, Long Lan, Xiaoguang Ren, Tongliang Liu, and Bo Han. 2024. Unveiling causal reasoning in large language models: Reality or mirage? Advances in Neural Information Processing Systems 37 (2024), 96640–96670. [8] Haoang Chi, Feng Liu, Wenjing Yang, Long Lan, Tongliang Liu, Bo Han, William Cheung, and James Kwok. 2021. TOHAN: A one-step approach towards few-shot hypothesis adaptation. Advances in neural information processing systems 34 (2021), 20970–20982. [9] Haoang Chi, Feng Liu, Wenjing Yang, Long Lan, Tongliang Liu, Bo Han, Gang Niu, Mingyuan Zhou, and Masashi Sugiyama. 2022. Meta Discovery: Learning to Discover Novel Classes given Very Limited Data. In International Conference on Learning Representations. [10] Haoang Chi, Wenjing Yang, Feng Liu, Long Lan, Tao Qin, and Bo Han. 2024. Does Confusion Really Hurt Novel Class Discovery? International Journal of Computer Vision 132, 8 (2024), 3191–3207. [11] Gheorghe Comanici, Eric Bieber, Mike Schaekermann, Ice Pasupat, Noveen Sachdeva, Inderjit Dhillon, Marcel Blistein, Ori Ram, Dan Zhang, Evan Rosen, et al. 2025. Gemini 2.5: Pushing the frontier with advanced reasoning, multimodality, long context, and next generation agentic capabilities. arXiv preprint arXiv:2507.06261 (2025). [12] Ling Dai, Bin Sheng, Tingli Chen, Qiang Wu, Ruhan Liu, Chun Cai, Liang Wu, Dawei Yang, Haslina Hamzah, Yuexing Liu, et al. 2024. A deep learning system for predicting time to progression of diabetic retinopathy. Nature Medicine 30, 2 (2024), 584–594. [13] Dominic Grün, Mauro J Muraro, Jean-Charles Boisset, Kay Wiebrands, Anna Lyubimova, Gitanjali Dharmadhikari, Maaike van den Born, Johan Van Es, Erik Jansen, Hans Clevers, et al. 2016. De novo prediction of stem cell identity using single-cell transcriptome data. Cell stem cell 19, 2 (2016), 266–277. [14] Daya Guo, Dejian Yang, Haowei Zhang, Junxiao Song, Ruoyu Zhang, Runxin Xu, Qihao Zhu, Shirong Ma, Peiyi Wang, Xiao Bi, et al. 2025. Deepseek-r1: Incentivizing reasoning capability in llms via reinforcement learning. arXiv preprint arXiv:2501.12948 (2025). [15] Laleh Haghverdi, Maren Büttner, F Alexander Wolf, Florian Buettner, and Fabian J Theis. 2016. Diffusion pseudotime robustly reconstructs lineage branching. Nature methods 13, 10 (2016), 845–848. [16] Jian Hu, Xiangjie Li, Kyle Coleman, Amelia Schroeder, Nan Ma, David J Irwin, Edward B Lee, Russell T Shinohara, and Mingyao Li. 2021. SpaGCN: Integrating gene expression, spatial location and histology to identify spatial domains and spatially variable genes by graph convolutional network. Nature methods 18, 11 (2021), 1342–1351. [17] Geert-Jan Huizing, Jules Samaran, Daniele Capocefalo, Anna Audit, Gabriel Peyré, and Laura Cantini. 2025. STORIES: learning cell fate landscapes from spatial transcriptomics using optimal transport. Nature Methods (2025), 1–10. [18] Nigel Kee, Nikolaos Volakakis, Agnete Kirkeby, Lina Dahl, Helena Storvall, Sara Nolbrant, Laura Lahti, Åsa K Björklund, Linda Gillberg, Eliza Joodmardi, et al. 2017. Single-cell analysis reveals a close relationship between differentiating dopamine and subthalamic nucleus neuronal lineages. Cell stem cell 20, 1 (2017), 29–40. [19] Markus Kleinewietfeld, Arndt Manzel, Jens Titze, Heda Kvakan, Nir Yosef, Ralf A Linker, Dominik N Muller, and David A Hafler. 2013. Sodium chloride drives autoimmune disease by the induction of pathogenic TH17 cells. Nature 496, 7446 (2013), 518–522. [20] He Li, Haoang Chi, Mingyu Liu, Wanrong Huang, Liyang Xu, and Wenjing Yang. 2025. Transformer-Based Spatial-Temporal Counterfactual Outcomes Estimation. In Forty-second International Conference on Machine Learning. [21] Andres M. Bran, Sam Cox, Oliver Schilter, Carlo Baldassari, Andrew D White, and Philippe Schwaller. 2024. Augmenting large language models with chemistry tools. Nature Machine Intelligence 6, 5 (2024), 525–535. [22] Evan Z Macosko, Anindita Basu, Rahul Satija, James Nemesh, Karthik Shekhar, Melissa Goldman, Itay Tirosh, Allison R Bialas, Nolan Kamitaki, Emily M Martersteck, et al. 2015. Highly parallel genome-wide expression profiling of individual

Songhan Wang et al.

cells using nanoliter droplets. Cell 161, 5 (2015), 1202–1214. [23] Sachin Mathur, Mathieu Beauvais, Arnau Giribet, Nicolas Aragon Barrero, Chaorui-Tom Zhang, Towsif Rahman, Seqian Wang, Jeremy Huang, Nima Nouri, Andre Kurlovs, et al. 2025. PyEvoCell: an LLM-augmented single-cell trajectory analysis dashboard. Bioinformatics 41, 4 (2025), btaf158. [24] Jeffrey R Moffitt, Dhananjay Bambah-Mukku, Stephen W Eichhorn, Eric Vaughn, Karthik Shekhar, Julio D Perez, Nimrod D Rubinstein, Junjie Hao, Aviv Regev, Catherine Dulac, et al. 2018. Molecular, spatial, and functional single-cell profiling of the hypothalamic preoptic region. Science 362, 6416 (2018), eaau5324. [25] Efthymia Papalexi and Rahul Satija. 2018. Single-cell RNA sequencing to explore immune cell heterogeneity. Nature Reviews Immunology 18, 1 (2018), 35–45. [26] Chen Qian, Wei Liu, Hongzhang Liu, Nuo Chen, Yufan Dang, Jiahao Li, Cheng Yang, Weize Chen, Yusheng Su, Xin Cong, et al. 2024. Chatdev: Communicative agents for software development. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). 15174–15186. [27] Xiaojie Qiu, Qi Mao, Ying Tang, Li Wang, Raghav Chawla, Hannah A Pliner, and Cole Trapnell. 2017. Reversed graph embedding resolves complex single-cell trajectories. Nature methods 14, 10 (2017), 979–982. [28] Anjali Rao, Dalia Barkley, Gustavo S França, and Itai Yanai. 2021. Exploring tissue architecture using spatial transcriptomics. Nature 596, 7871 (2021), 211–220. [29] Honglei Ren, Benjamin L Walker, Zixuan Cang, and Qing Nie. 2022. Identifying multicellular spatiotemporal organization of cells with SpaceFlow. Nature communications 13, 1 (2022), 4076. [30] Samuel G Rodriques, Robert R Stickels, Aleksandrina Goeva, Carly A Martin, Evan Murray, Charles R Vanderburg, Joshua Welch, Linlin M Chen, Fei Chen, and Evan Z Macosko. 2019. Slide-seq: A scalable technology for measuring genome-wide expression at high spatial resolution. Science 363, 6434 (2019), 1463–1467. [31] Wouter Saelens, Robrecht Cannoodt, Helena Todorov, and Yvan Saeys. 2019. A comparison of single-cell trajectory inference methods. Nature biotechnology 37, 5 (2019), 547–554. [32] Nicholas Schaum, Jim Karkanias, Norma F Neff, Andrew P May, Stephen R Quake, Tony Wyss-Coray, Spyros Darmanis, Joshua Batson, Olga Botvinnik, Michelle B Chen, et al. 2018. Single-cell transcriptomics of 20 mouse organs creates a Tabula Muris: The Tabula Muris Consortium. Nature 562, 7727 (2018), 367. [33] Antonio Scialdone, Yosuke Tanaka, Wajid Jawaid, Victoria Moignard, Nicola K Wilson, Iain C Macaulay, John C Marioni, and Berthold Göttgens. 2016. Resolving early mesoderm diversification through single-cell expression profiling. Nature 535, 7611 (2016), 289–293. [34] Alex K Shalek, Rahul Satija, Xian Adiconis, Rona S Gertner, Jellert T Gaublomme, Raktima Raychowdhury, Schraga Schwartz, Nir Yosef, Christine Malboeuf, Diana Lu, et al. 2013. Single-cell transcriptomics reveals bimodality in expression and splicing in immune cells. Nature 498, 7453 (2013), 236–240. [35] Kelly Street, Davide Risso, Russell B Fletcher, Diya Das, John Ngai, Nir Yosef, Elizabeth Purdom, and Sandrine Dudoit. 2018. Slingshot: cell lineage and pseudotime inference for single-cell transcriptomics. BMC genomics 19, 1 (2018), 477. [36] Amos Tanay and Aviv Regev. 2017. Scaling single-cell genomics from phenomenology to mechanism. Nature 541, 7637 (2017), 331–338. [37] Fuchou Tang, Catalin Barbacioru, Yangzhou Wang, Ellen Nordman, Clarence Lee, Nanlan Xu, Xiaohui Wang, John Bodeau, Brian B Tuch, Asim Siddiqui, et al. 2009. mRNA-Seq whole-transcriptome analysis of a single cell. Nature methods 6, 5 (2009), 377–382. [38] Cole Trapnell, Davide Cacchiarelli, Jonna Grimsby, Prapti Pokharel, Shuqiang Li, Michael Morse, Niall J Lennon, Kenneth J Livak, Tarjei S Mikkelsen, and John L Rinn. 2014. The dynamics and regulators of cell fate decisions are revealed by pseudotemporal ordering of single cells. Nature biotechnology 32, 4 (2014), 381–386. [39] Daniel E Wagner and Allon M Klein. 2020. Lineage tracing meets single-cell omics: opportunities and challenges. Nature Reviews Genetics 21, 7 (2020), 410–427. [40] Hanchen Wang, Tianfan Fu, Yuanqi Du, Wenhao Gao, Kexin Huang, Ziming Liu, Payal Chandak, Shengchao Liu, Peter Van Katwyk, Andreea Deac, et al. 2023. Scientific discovery in the age of artificial intelligence. Nature 620, 7972 (2023), 47–60. [41] F Alexander Wolf, Fiona K Hamey, Mireya Plass, Jordi Solana, Joakim S Dahlin, Berthold Göttgens, Nikolaus Rajewsky, Lukas Simon, and Fabian J Theis. 2019. PAGA: graph abstraction reconciles clustering with trajectory inference through a topology preserving map of single cells. Genome biology 20, 1 (2019), 59. [42] Chuan Wu, Nir Yosef, Theresa Thalhamer, Chen Zhu, Sheng Xiao, Yasuhiro Kishi, Aviv Regev, and Vijay K Kuchroo. 2013. Induction of pathogenic TH17 cells by inducible salt-sensing kinase SGK1. Nature 496, 7446 (2013), 513–517. [43] Yihang Xiao, Jinyi Liu, Yan Zheng, Xiaohan Xie, Jianye Hao, Mingzhi Li, Ruitao Wang, Fei Ni, Yuxiao Li, Jintian Luo, et al. 2024. Cellagent: An llm-driven multi-agent framework for automated single-cell data analysis. arXiv preprint arXiv:2407.09811 (2024). [44] Wenjing Yang, Haoang Chi, Yibing Zhan, Bowen Hu, Xiaoguang Ren, Dapeng Tao, and Long Lan. 2025. NT-FAN: A Simple yet Effective Noise-tolerant Few-shot Adaptation Network. Artificial Intelligence (2025), 104363.

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

Graph Initialization: A simpler graph structure (e.g., a tree) is initialized in the latent space Z. Optimization Objective: The algorithm iteratively updates the graph nodes VT and edges to minimize the distance between the data points and the graph structure, typically minimizing a regularized quantization error:

Planner Agent Output Format 1

{ "User Task Description": "{user_task}", "User Data Description": "{data_representation}", "Output Format Requirements": { "steps": [ { "id": 1, "description": "Step 1 description" }, { "id": 2, "description": "Step 2 description" } ] }

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

min

𝑁 ∑︁

T,Y

||z𝑖 − 𝑓 (z𝑖 )|| 2 + 𝜆Ω(T ).

(7)

𝑖=1

where 𝑓 (z𝑖 ) projects cell 𝑖 to the nearest point on the graph T , and Ω(T ) is a regularization term enforcing graph smoothness or tree structure. Geodesic Pseudotime: Upon convergence, the pseudotime is defined as the geodesic distance 𝑑𝑔 (·, ·) along the learned principal graph from a designated root node 𝑟 : 𝜏𝑖 = 𝑑𝑔 (proj(z𝑖 , T ), 𝑟 ).

A.2

}

A Methods Details A.1 TI analysis We formalize the Trajectory Inference (TI) task as a manifold learning problem. Given a single-cell gene expression matrix X ∈ R𝑁 ×𝑀 comprising 𝑁 cells and 𝑀 genes, the objective is to learn a lowdimensional manifold M embedded in a latent space Z ∈ R𝑁 ×𝑑 (where 𝑑 ≪ 𝑀), and a pseudotime function 𝜏 : Z → R ≥0 that maps each cell to its developmental progression. We contrast two dominant formalisms employed in our evaluation: cluster-based abstraction and principal graph learning. A.1.1 Cluster-based Formalism. This class of methods approximates the continuous manifold M using a coarse-grained graph derived from discrete cell partitions. Manifold Partitioning: The latent space Z is partitioned into 𝑘 disjoint clusters C = {𝐶 1, 𝐶 2, . . . , 𝐶𝑘 } using algorithms such as Louvain or 𝑘-means. Each cluster is represented by a centroid 𝜇𝑖 . Graph extraction: A connectivity graph G𝑎𝑏𝑠 = (V, E) is constructed where nodes V correspond to cluster centroids. An edge 𝑒𝑖 𝑗 ∈ E is established if the connectivity metric 𝑆 (𝐶𝑖 , 𝐶 𝑗 ) (e.g., statistical interconnectivity in PAGA) exceeds a threshold 𝛿: E = {(𝑖, 𝑗) | 𝑆 (𝐶𝑖 , 𝐶 𝑗 ) > 𝛿 }.

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

(8)

System Prompts and Instructions

The cognitive architecture of SpaCellAgent is governed by rolespecific system instructions that delineate the operational boundaries and reasoning protocols for each agent. Below, we provide the verbatim system prompts used to instantiate the Planner, Executor, and Evaluator agents. These prompts are engineered to enforce strict adherence to biological logic, code syntax correctness, and iterative self-refinement. The cognitive architecture of SpaCellAgent is governed by rolespecific system instructions that delineate the operational boundaries and reasoning protocols for each agent. Below, we provide the verbatim system prompts used to instantiate the Planner, Executor, and Evaluator agents. These prompts are engineered to enforce strict adherence to biological logic, code syntax correctness, and iterative self-refinement. A.2.1 Planner Agent Prompt. The Planner is instructed to decompose the user’s biological query into a logical sequence of analytical milestones. A.2.2 Executor Agent Prompt. The Executor is tasked with translating the high-level plan into executable Python scripts, utilizing the predefined tool registry. A.2.3 Evaluator Agent Prompt. The Evaluator serves as the quality assurance module, analyzing execution logs and visual outputs to synthesize refinement strategies.

A.3

Tool Definition

(5)

Curve Fitting and Pseudotime: A set of smooth principal curves Γ = {𝛾 1, . . . , 𝛾𝑏 } is fitted through the centroids along the topology of G𝑎𝑏𝑠 . The pseudotime 𝜏𝑖 for a cell z𝑖 is computed by projecting the cell onto the nearest curve 𝛾: ∫ proj(z𝑖 ,𝛾 ) 𝜕𝛾 (𝑡) 𝜏𝑖 = || ||𝑑𝑡 . (6) 𝜕𝑡 root A.1.2 Principal Graph Learning. Instead of relying on discrete clusters, this formalism employs Reverse Graph Embedding (RGE) to learn a continuous tree structure T directly within the latent space.

To facilitate the autonomous orchestration of complex bioinformatics workflows, we provide the Executor agent with a rigorous Tool Registry Schema. As presented in Table 5, each computational tool (e.g., functions from Scanpy, Squidpy, or Monocle3) is encapsulated with a semantic description, strict parameter constraints, and input/output specifications. This structured definition enables the Large Language Model (LLM) to accurately map high-level analytical intent to specific function calls without hallucinating non-existent parameters.

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

Songhan Wang et al.

Executor Agent System Prompt (Part I: Context) 1

{ "prompt": [ "You are a professional bioinformatics code writing expert.", "Please write Python code to complete the current task step based on the following information.",

2 3 4 5

"User Requirements:", "{user_requirements}", "Data Description:", "{data_description}", "Historical Code:", "{historical_code}", "Current Task Step:", "{step_description}"

6 7 8 9 10 11 12 13

]

14 15

}

Table 5: Summary of mainstream tools and workflows for single-cell and spatial transcriptomics analysis. Analysis Step

Description

Mainstream Tools

Lang.

Preprocessing & QC

Quality control, doublet removal, mitochondrial gene filtering, and data normalization.

Scanpy, Seurat, DoubletFinder

Py/R

Dimensionality Reduction

Mapping high-dimensional gene expression data into low-dimensional space (PCA, UMAP, t-SNE).

Scanpy, Seurat

Py/R

Clustering & Annotation

Identifying cell subgroups based on profiles and annotating cell types using marker genes.

Leiden, Louvain, SingleR

Py/R

Trajectory Inference

Constructing pseudo-temporal ordering to reconstruct cell differentiation lineages.

Monocle3, Slingshot, PAGA, Palantir

R/Py

RNA Velocity

Predicting future cell states using the ratio of spliced to unspliced transcripts.

scVelo, velocyto

Py

Fate Probability

Integrating velocity and trajectory data to compute differentiation probabilities.

CellRank

Py

Differential Expression

Identifying statistically significant differentially expressed genes (DEGs) between clusters.

Wilcoxon Rank Sum, DESeq2, MAST

R/Py

Functional Enrichment

Analyzing biological pathways (GO, KEGG) enriched in specific gene sets.

clusterProfiler, gseapy, GSEA

R/Py

Cell-Cell Communication

Inferring intercellular interaction networks based on ligand-receptor databases.

CellChat, CellPhoneDB, NicheNet

R/Py

Spatial Analysis

Identifying spatial domains and spatially variable genes (SVGs) using coordinates.

Squidpy, Giotto, SpaceRanger

Py/R

B Experimental Details B.1 Dataset Details To comprehensively evaluate the generalization capability and robustness of the SpaCellAgent framework, we curated a diverse benchmark suite comprising three published real-world datasets,

one unpublished real-world dataset, and one simulated dataset. These datasets encompass a wide spectrum of biological contexts, ranging from distinct organisms to varying tissue types. We fix the seed as 42 to ensure that the same spatial transcriptomics dataset yields consistent analytical trajectories across multiple runs.

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

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

Executor Agent System Prompt (Part II: Requirements) 1

{ "prompt_continued": [ "Selected Tools and Their Documentation:", "{tools_docs}", "∗∗Important: Data Loading Strategy∗∗", "{data_loading_strategy}",

2 3 4 5 6 7

"Requirements:", "− Use the selected tools to complete the task.", "− The code should include necessary imports and data loading.", "− ∗∗Data Loading∗∗: {data_loading_instruction}",

8 9 10 11 12 13

"− ∗∗Data Saving∗∗: At the end of the code, you must add code to save intermediate", " results: `adata.write_h5ad('{intermediate_file_path}')`",

14 15 16 17

"− The code should use the data file path: {data_file_path}", "− ∗∗Must use correct Python syntax∗∗",

18 19 20

"− If the current step involves \"trajectory inference / pseudotime...\",", " please follow these additional output specifications:", "{ti_output_requirements}",

21 22 23 24 25

"− Do not add any explanations or comments, only provide code.", "− The output format is a code block, wrapped with ```python and ```."

26 27

]

28 29

}

Evaluator Agent System Prompt 1

{ "prompt": [ "You are an experienced bioinformatics expert.", "Please evaluate whether the code execution was successful...", "", "∗∗Important Evaluation Rules∗∗:", "1. If the execution results contain any of the following keywords, the execution failed:", " − \"Execution error\", \"Execution failed\"", " − \"Error\", \"Exception\", \"Traceback\"", " ...", "", "User Requirements:", "{user_requirements}", "", "Please output strictly in the following format..." ]

2 3 4

5 6 7

8 9 10 11 12 13 14 15 16 17

}

Crucially, the selected datasets exhibit significant heterogeneity in terms of data sparsity, sequencing depth, and underlying topological complexity (including linear, bifurcation, and multifurcation trajectories). This diversity allows us to rigorously assess the agent’s ability to autonomously adapt its analysis strategy to different data distributions and sequencing technologies (e.g., 10x Genomics, Smart-seq2, and spatial transcriptomics protocols).

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

Songhan Wang et al.

Bio-Evaluator Agent System Prompt {

1

"prompt": [ "You are a distinguished Senior Computational Biologist.", "Your task is to evaluate the ∗∗scientific validity∗∗ and ∗∗biological plausibility∗∗ of the analysis results generated by the previous step.", "Unlike the Code Evaluator, you assume the code executed without errors; your focus is on the ∗∗quality and meaning∗∗ of the output.", "∗∗Evaluation Criteria∗∗:", "1. ∗∗Data Integrity & Statistics∗∗:", " − Check if the output contains valid biological signals (e.g., variable genes found, clusters identified).", " − Fail if results are empty, trivial (e.g., 0 cells remaining), or statistically insignificant (e.g., all p−values > 0.05).", "2. ∗∗Biological Plausibility∗∗:", " − ∗∗Clustering∗∗: Fail if the number of clusters is extreme (e.g., 1 cluster or >100 clusters for a small dataset).", " − ∗∗Annotation∗∗: Fail if marker genes are non−specific (e.g., mitochondrial genes only).", "3. ∗∗Trajectory Inference (TI) Specifics∗∗ (if applicable):", " − ∗∗Topology∗∗: Fail if the inferred trajectory is highly fragmented (disconnected manifolds) or purely linear when branching is expected.", " − ∗∗Pseudotime∗∗: Check if the root cell selection aligns with user intent (e.g., time 0 should be at the stem/progenitor stage).", "User Requirements: {user_requirements}", "Data Description: {data_description}", "Current Task Step: {step_description}", "Analysis Results (Logs & Summaries): {execution_result}", "Please output strictly in the following format:", "Evaluation Result: [Pass / Fail / Needs Refinement]", "Biological Critique: [Briefly analyze the biological meaning. E.g., \"Trajectory successfully captures the bifurcating lineage.\"]", "Refinement Strategy: [If Fail: Provide specific parameter adjustments (e.g., \"Increase resolution to 0.8\"). If Pass: \"None\"]" ]

2 3 4

5

6 7 8 9 10 11 12 13 14

15

16 17 18 19 20 21 22

23 24

}

25

B.2

Preprocessing Pipeline

To ensure the robustness of downstream trajectory inference tasks and mitigate the technical noise inherent in high-throughput sequencing technologies (e.g., dropouts, amplification bias), we im𝑁 plement a rigorous preprocessing pipeline Φ. Let D = {(x𝑖 , s𝑖 )}𝑖=1 𝑀 denote the raw dataset, where x𝑖 ∈ R represents the gene expression vector for cell 𝑖 across 𝑀 genes, and s𝑖 ∈ R2 denotes its spatial coordinates (if applicable). The pipeline transforms this raw input into a denoised, low-dimensional latent representation Z, formally defined as: Z = Φ(X) = PCA(SelectFeatures(LogNorm(QC(X)))).

(9)

The detailed protocol typically involves the following four stages: B.2.1 Stage 1: Quality Control (QC). The first stage filters out lowquality observations that could introduce artifacts into the manifold learning process. We define the set of valid cells D ′ by imposing

constraints on the library size (total counts) and mitochondrial content. Low library sizes often indicate empty droplets or dead cells, while anomalously high counts suggest doublets. High mitochondrial proportions are a signature of cellular stress or apoptosis. D ′ = {𝑖 | ∧

min_genes < ∥x𝑖 ∥ 0 < max_genes pct_mt(x𝑖 ) < 𝜃𝑚𝑡 }.

(10)

where ∥x𝑖 ∥ 0 denotes the number of detected genes (L0 norm), and 𝜃𝑚𝑡 is the threshold for mitochondrial percentage (typically 10% − 20%). B.2.2 Stage 2: Normalization and Variance Stabilization. Since cellular sequencing depths can vary significantly due to technical capture efficiency rather than biological differences, we apply a global scaling normalization. The expression vector for each cell is normalized to a fixed total count 𝑠: x𝑖 x𝑖′ = 𝑠 · Í . (11) 𝑗 𝑥𝑖 𝑗

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

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

Table 6: Statistics of the two spatial datasets and the unpublished dataset used in this study. The symbol “×” represents the dimensions of the expression matrix (Cells × Genes). Dataset

Organism

Shape (Cell × Gene)

Technology

Type

Source

Mouse Midbrain (E12.5) Mouse Midbrain (E14.5) Mouse Midbrain (E16.5) Mouse Midbrain (Total)

Mouse Mouse Mouse Mouse

3, 671 × 24, 045 3, 648 × 24, 045 19, 419 × 24, 045 26,738 × 24,045

Stereo-seq Stereo-seq Stereo-seq Stereo-seq

Spatial Spatial Spatial Spatial

Chen et al. Chen et al. Chen et al. Chen et al.

Axolotl Neuron (D2) Axolotl Neuron (D5) Axolotl Neuron (D10) Axolotl Neuron (D20) Axolotl Neuron (D30) Axolotl Neuron (Total)

Axolotl Axolotl Axolotl Axolotl Axolotl Axolotl

518 × 10, 000 726 × 10, 000 911 × 10, 000 1, 437 × 10, 000 1, 345 × 10, 000 4,937 × 10,000

Stereo-seq Stereo-seq Stereo-seq Stereo-seq Stereo-seq Stereo-seq

Spatial Spatial Spatial Spatial Spatial Spatial

Chen et al. Chen et al. Chen et al. Chen et al. Chen et al. Chen et al.

Mouse SCI (HSSAM) Mouse SCI (HSD7) Mouse SCI (HSD28) Mouse SCI (NSSAM) Mouse SCI (NSD7) Mouse SCI (NSD28) Mouse SCI (Total)

Mouse Mouse Mouse Mouse Mouse Mouse Mouse

9, 094 × 55, 401 13, 526 × 55, 401 11, 268 × 55, 401 9, 926 × 55, 401 8, 145 × 55, 401 11, 074 × 55, 401 63,033 × 55,402

10x Genomics 10x Genomics 10x Genomics 10x Genomics 10x Genomics 10x Genomics 10x Genomics

scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq

This work This work This work This work This work This work This work

Subsequently, we apply a natural logarithm transformation to stabilize the variance across the dynamic range of expression values and to transform the data distribution closer to normality: x𝑖′′ = ln(x𝑖′ + 1).

(12)

The addition of a pseudo-count of 1 preserves sparsity for nonexpressed genes. B.2.3 Stage 3: Feature Selection (HVGs). To reduce computational complexity and focus on biological heterogeneity, we subset the feature space to Highly Variable Genes (HVGs). We model the relationship between mean expression 𝜇 𝑗 and dispersion 𝜎 𝑗2 for each gene 𝑗. Genes with a dispersion significantly higher than expected given their mean expression are retained, forming the subset 𝐺 𝐻𝑉 𝐺 (typically |𝐺 𝐻𝑉 𝐺 | ≈ 2000). This step effectively filters out housekeeping genes (constant expression) and low-abundance noise. B.2.4 Stage 4: Latent Manifold Embedding. Finally, we project the high-dimensional normalized data restricted to 𝐺 𝐻𝑉 𝐺 into a lowerdimensional latent space to capture the principal axes of variation. We perform Principal Component Analysis (PCA) via Singular Value Decomposition (SVD) on the centered and scaled data matrix: Z = SVD𝑘 (X𝐻𝑉 𝐺 − X̄𝐻𝑉 𝐺 ).

(13)

The resulting matrix Z ∈ R𝑁 ×𝑘 (where 𝑘 = 50) serves as the compact input representation for the subsequent agent-driven trajectory inference modules. This projection preserves the global topology of the cellular manifold while discarding orthogonal components largely attributed to technical noise.

B.3

Additional Experiments

LLM-based baselines comparison. We conducted an additional experiment to compare our framework with the following LLMbased baselines to demonstrate the advantages of our framework: • CellAgent: a LLM-driven multi-agent framework for singlecell RNA sequencing (scRNA-seq) data analysis. • scAgents: a multi-agent framework for fully autonomous end-to-end single-cell analysis. We experiment with five subsets (S1 to S5) from the real gold benchmark and calculate the Spearman rank correlation. The results are in the Table 9. According to the results, our method shows the best performance. Quantitative biological validation. To quantitatively validate the biological fidelity of the trajectories results in the main experiment, we performed an enrichment analysis based on our TI results of the three real-world datasets. Specifically, we quantified the GO enrichment p-values for the dynamic driver genes identified along the trajectory. The results are given in the Table 10. The results can statistically prove that the genes discovered by our agent are significantly enriched in the expected biological pathways.

B.4

Visualization of Trajectories

To provide a comprehensive qualitative assessment of SpaCellAgent, we present additional visualizations of the inferred cellular trajectories across benchmarks, as shown in Figure 10 11 12 9 8. The figures below illustrate the low-dimensional manifold embeddings colored by inferred pseudotime and ground-truth cell types. These visualizations visually substantiate our quantitative findings, demonstrating the framework’s capability to correctly recover complex topologies, including linear, bifurcating, and multifurcating lineages, that characterize diverse biological processes.

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

Songhan Wang et al.

Table 7: Overview of the single-cell datasets selected from the REAL-GOLD and REAL-SILVER benchmarks. Columns indicate the organism, dataset shape, and experimental technology. Organism

B.5

Shape (Cell × Gene)

Technology

Type

Mouse Mouse Mouse Mouse Mouse Mouse

291 × 3, 582 65 × 1, 095 541 × 3, 630 408 × 3, 387 435 × 3, 604 264 × 5, 310

Fluidigm C1 Fluidigm C1 Smart-seq Smart-seq Smart-seq Fluidigm C1

scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq

Human Human Human Human Mouse Human

272 × 5, 708 166 × 3, 457 101 × 3, 502 222 × 3, 766 238 × 1, 845 1, 299 × 4, 135

Tang et al. Tang et al. Tang et al. Fluidigm C1 Fluidigm C1 Fluidigm C1

scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq

Mouse Mouse Mouse Mouse Mouse Mouse

873 × 2, 863 493 × 2, 406 158 × 1, 737 117 × 1, 673 85 × 1, 584 85 × 1, 648

Smart-seq Smart-seq Fluidigm C1 Fluidigm C1 Fluidigm C1 Fluidigm C1

scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq

GSE59114

Mouse Mouse Mouse Human Human

197 × 3, 982 355 × 3, 301 3, 694 × 999 4, 959 × 1, 008 501 × 3, 523

Fluidigm C1 Fluidigm C1 Fluidigm C1 Fluidigm C1 Fluidigm C1

scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq

GSE74596 GSE67310 GSE75330

Macaque Macaque Macaque Macaque

182 × 5, 273 83 × 4, 780 272 × 5, 376 351 × 5, 416

SC3-seq SC3-seq SC3-seq SC3-seq

scRNA-seq scRNA-seq scRNA-seq scRNA-seq

GSE74767

Mouse Mouse Mouse Mouse Mouse Mouse

318 × 2, 702 376 × 2, 967 60 × 1, 849 749 × 1, 033 699 × 1, 060 346 × 1, 009

Fluidigm C1 Fluidigm C1 Smart-seq2 Fluidigm C1 Fluidigm C1 Fluidigm C1

scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq

GSE70240, 243, 244, 236 GSE70240, 244, 236 GSE79363 GSE67602

Mouse Human Human Human Human

213 × 4, 872 659 × 3, 630 629 × 4, 691 659 × 3, 630 671 × 4, 459

Fluidigm C1 Smart-seq2 Smart-seq2 Smart-seq2 Smart-seq2

scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq

GSE90860 GSE86146

Downstream Analysis

Beyond reconstructing the backbone of cellular development, SpaCellAgent autonomously conducts downstream characterization to uncover biological mechanisms. In this section, we include supplementary results of the Axolotl Neuron Regeneration dataset

Source GSE52529 GSE52583 GSE48968

E-MTAB-2805 GSE63818

GSE64016 GSE60781 E-MTAB-3929

GSE71982

GSE85066

(13 14), and visualizations of gene expression dynamics along the inferred paths of the Mouse Dorsal Midbrain dataset (15). The following heatmaps and gene trend plots highlight the agent’s ability to identify spatially and temporally variable genes that drive cell fate decisions, confirming the biological plausibility of the reconstructed lineages.

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

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

Table 8: Overview of the single-cell datasets selected from the REAL-GOLD and REAL-SILVER benchmarks (Continued). Organism

Shape (Cell × Gene)

Technology

Type

Source

Mouse Mouse Mouse Mouse Mouse

322 × 6, 763 563 × 6, 372 503 × 2, 037 192 × 1, 534 456 × 3, 585

Smart-seq2 Smart-seq2 Smart-seq2 Smart-seq2 Smart-seq2

scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq

GSE87375

Fly Fly Fly Mouse Mouse

277 × 1, 514 169 × 982 454 × 2, 703 3, 580 × 698 414 × 12, 532

Smart-seq2 Smart-seq2 Smart-seq2 10X Chromium rdRNA-seq

scRNA-seq scRNA-seq scRNA-seq scRNA-seq scRNA-seq

GSE100058

GSE90047 GSE99951

GSE95315 GSE98664

Subset_1: pancreatic-alpha-cell-maturation_zhang

Figure 8: The visualization pseudotime results of TI analysis by SpaCellAgent compared with ground truth on REAL-GOLD dataset. Table 9: Performance comparison with LLM-based baseline methods. Method

S1

S2

S3

S4

S5

CellAgent scAgents

0.473 0.440

0.577 0.458

0.577 0.533

0.481 0.475

0.703 0.642

Ours

0.526

0.615

0.571

0.483

0.755

Table 10: P-values of the GO enrichment analysis on three real-world datasets.

B.6

Metrics

Midbrain

Axolotl

SCI

P-values

< 0.001

< 0.001

< 0.001

Extended results of Case Study

Due to space constraints in the main manuscript, we provide an extended analysis of the case studies here. We intermediate outputs generated during the analysis of theunpublished Mouse SCI

datasets. As shown in Figure 16, the visualization of the pseudotime plot and PAGA plot shows the global TI of Mouse SCI datasets. Then, we plot the DEG heat map of the whole Mouse SCI dataset using SpaCellAgent, as shown in Figure 17. Subsequently, we conduct gene ontology enrichment analysis on the whole dataset, as shown in Figure 18. These results further exemplify the robustness of the self-evolution module, visualizing how the agent detects anomalies, corrects errors, and iteratively refines the trajectory model to align with biological priors.

B.7

Ablation Studies Details

Expert Selection.We recruit 5 domain experts: Expert 1 holds a Ph.D. degree in biomedical engineering. Expert 2 to 5 holds Ph.D. degrees in clinical medicine. Crucially, all experts possess over 3 years of hands-on experience in omics data analysis. Standardized Instructions. Before the experiment, all experts receive a briefing on the task objectives and success criteria:

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

Songhan Wang et al.

Table 11: Definition of the Standardized Trajectory Inference (TI) Workflow. This workflow, consisting of six sequential tasks, serves as the benchmark for evaluating Task Success Rate (TSR) in the ablation study. Task ID

Task Name

Description & Objectives

Task 1

Data Ingestion and Quality Control

Load raw expression matrix and spatial coordinates. Filter low-quality cells (e.g., high mitochondrial content, low gene counts) to output a cleaned AnnData object.

Task 2

Preprocessing and Normalization

Normalize data (e.g., CPM) and perform logarithmic transformation. Identify Highly Variable Genes (HVGs) to mitigate feature space noise.

Task 3

Dimensionality Reduction

Perform Principal Component Analysis (PCA) on HVGs, followed by non-linear reduction (e.g., UMAP, t-SNE) to visualize the global manifold structure.

Task 4

Clustering and Root Identification

Cluster cells (Leiden/Louvain) and identify the trajectory start point ("root") via automatic marker detection (e.g., stemness genes) or user priors.

Task 5

Trajectory Inference and Pseudotime Calculation

Core Step: Apply specific TI algorithms (e.g., PAGA, DPT, Monocle) to infer the lineage backbone and calculate pseudotime values for all cells.

Task 6

Visualization and Result Export

Visualize the inferred trajectory on low-dimensional embeddings (colored by pseudotime) and export the final object for downstream analysis.

Table 12: Definition of the Standardized Trajectory Inference (TI) Workflow. This workflow, consisting of five sequential tasks, serves as the benchmark for evaluating Task Success Rate (TSR) in the ablation study. Task ID

Task Name

Task 1

Data Ingestion and Quality Control

Task 2

Preprocessing and Normalization

Task 3

Dimensionality Reduction

Task 4

Clustering and Root Identification

Task 5

Trajectory Inference and Pseudotime Calculation

Table 13: ablation study with the w/o experience memory variants. Model

correlation

P-value

Time cost

w/o experience memory

0.526

< 0.001

46.0

Ours

0.538

< 0.001

38.0

• Task objectives. They are provided with basic information about the test datasets, a standardized analysis workflow, and the flexibility to select their preferred analytical tools based on personal expertise and preference. • Success criteria. When the expert finishes the TI analysis and validates its biological relevance and significance. Tool Equivalency. The human experts are equipped with standard SOTA computational tools widely used in the industry. We list these computational tools and provide them to both the human experts and SpaCellAgent. Timing Protocol. The timer commences exactly when the raw datasets are made available to the user/expert and concludes when

the final validated output is submitted. For a rigorous comparison, we partition the standard trajectory inference analysis into five standardized stages: Step 1: Data Preprocessing, Step 2: Batch Correction, Step 3: Cell Type Annotation, Step 4: Dimensionality Reduction and Clustering, Step 5: Trajectory inference and pseudotime calculation. Statistical Variance Analysis. To strengthen the claim of our 41.2% improvement, we provide the experiment details of appropriate statistical summaries (mean and standard deviation). The results are in the following table. To guarantee a fair and rigorous benchmark across all ablation variants (including SpaCellAgent w/o Planner, Evaluator, or SelfEvolution) and the GPT-4 baseline, we established a Standardized TI Workflow. This protocol systematically deconstructs the multifaceted lineage reconstruction process into six distinct, sequential tasks, mirroring the standard bioinformatics pipeline from data ingestion to visualization. Crucially, this granular decomposition allows us to pinpoint specific failure modes, whether they stem from logic errors in pseudotime calculation or syntax errors in plotting, thereby offering a high-resolution view of each component’s contribution. For the quantitative assessment via Task Success Rate (TSR), a variant is deemed successful at a specific step strictly if it generates executable code that yields valid intermediate artifacts without runtime exceptions. The detailed definitions of these six pivotal tasks are enumerated in Table 12. In our ablation study, the full SpaCellAgent autonomously generates this 5-step plan via its planner. In contrast, the w/o Planner variant attempts to execute the entire pipeline in a monolithic block, while GPT-4 operates without the guidance of this structured decomposition.

B.8

Additional Ablation Studies

To quantitatively verify the effectiveness of the Knowledge-augmented fallback mechanism, we conduct an ablation study with the w/o experience memory variants on the real-gold dataset. We calculate the Spearman’s rank correlation, p-value, and the total time cost. The results are shown in Table 13.

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

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

Subset_1: aging-hsc-young_kowalczyk

Subset_1: aging-hsc-old_kowalczyk

Figure 9: The visualization pseudotime results of TI analysis by SpaCellAgent compared with ground truth on REAL-GOLD dataset.

C

Additional Related Works

Recent Advancements in Robust Learning and Reasoning. In recent years, significant progress has been made in enhancing machine learning performance under complex data constraints and reasoning tasks. Addressing the challenges of data scarcity and distribution shifts, researchers have developed innovative frameworks for few-shot hypothesis adaptation [8, 44] and novel class discovery

[9, 10], which effectively improve model generalization in openworld scenarios. Beyond statistical learning, there is a growing trend towards integrating causal mechanisms into deep learning. For instance, Li et al. [20] introduced transformer-based architectures for spatial-temporal counterfactual estimation, while Chi et al. [7] conducted comprehensive evaluations to unveil the underlying causal reasoning capabilities of large language models.

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

Songhan Wang et al.

Subset 2: cellbench-SC4_luyitian

Subset 2: cell-cycle_leng

Figure 10: The visualization pseudotime results of TI analysis by SpaCellAgent compared with ground truth on REAL-GOLD dataset.

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

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

Subset 2: human-embryos_petropoulos

Subset 2: germline-human-female_guo

Figure 11: The visualization pseudotime results of TI analysis by SpaCellAgent compared with ground truth on REAL-GOLD dataset.

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

Songhan Wang et al.

Subset 2: myoblast-differentiation_trapnell

Subset 2: NKT-differentiation_engel

Figure 12: The visualization pseudotime results of TI analysis by SpaCellAgent compared with ground truth on REAL-GOLD dataset.

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

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

Figure 13: Spatial visualization of clusters, cell annotation by SpaCellAgent and ground truth annotation. 6SDWLDO1HLJKERU*UDSK&RORUHGE\&OXVWHU VHXUDWBFOXVWHUV 6DPSOHGQRGHVHGJHV

6SDWLDO&RRUGLQDWH'LVWULEXWLRQ&RORUHGE\&OXVWHU VHXUDWBFOXVWHUV                



<&RRUGLQDWH

  

   <&RRUGLQDWH



 







 









;&RRUGLQDWH















;&RRUGLQDWH





Figure 14: Visualization of spatial topology and neighborhood connectivity from Axolotl Neuron dataset. The left panel displays the spatial coordinate distribution of cells colored by identified clusters, illustrating the physical organization of the tissue. The right panel presents the constructed spatial neighbor graph (visualizing a sampled subgraph of 1,000 nodes and 3,018 edges for clarity), where edges denote physical proximity. This graph structure serves as a critical constraint for downstream analysis, ensuring that inferred trajectories respect the biological reality of spatial continuity.

QDQ_$0(;''

9,0_$0(;''

61$3_$0(;''

6/&$_$0(;''

6$_$0(;''

3&3/>QU@_$0(;''

16*_$0(;''

1),%_$0(;''

1'5*_$0(;''

/2&>QU@_$0(;''

/$03_$0(;''

*/8//>QU@_*/8/>KV@_$0(;''

*/8'_$0(;''

).%3%_$0(;''

&.%>KV@_$0(;''

&+*$_$0(;''

&(3_$0(;''

&&+B>QU@_3*$0>KV@_$0(;''

$1.5'&_$0(;''

$0(;''8

$0(;''

$0(;''

$0(;''

$0(;''

$0(;''

$$0'&_$0(;''

&OXVWHUV

*OREDO'(*+HDWPDS 7RSJHQHVSHUFOXVWHU

8QNQRZQ

GS(;,01

GS(;U,3&



PS(;



QSW[(;

UHD(*&

=VFRUH

KDD 2026, August 9–13, 2026, Jeju Island, Republic of Korea. Songhan Wang et al.

,01











UHD(*&,01

ZQW(*&





*HQHV

Figure 15: DEG heat map of Axolotl Neuron dataset. The visualization displays the top 3 marker genes identified for each annotated cell type (rows), such as IMN, mEX, and wntEGC. Columns represent specific genes, and the color scale reflects Z-score normalized expression levels, with red indicating upregulation and blue indicating downregulation, highlighting distinct molecular signatures for each cluster.

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

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

(A)

(B)

(C)

Figure 16: (A) Pseudotime of HS and NS mouse SCI dataset. (B) HS datasets’ comparison of TI Umap plot by PAGA and Pseudotime plot. (C) NS datasets’ comparison of TI Umap plot by PAGA and Pseudotime plot.

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

Songhan Wang et al.

'(*+HDWPDS+6YV16E\7LPH3RLQW

&KLO /\] (16086* 6D 6D



6DD *P (16086* 7\URES &DPS +LID )FUO *P )WO 1JS )FHUJ



(16086* $SREHF 6D 0W (16086* 6OFD )\E )JIU *P (16086* 6OFD (16086*



*P &\ED 25LN *5LN (16086* &G (16086* (16086* (16086* &PVV %FDVRV



$TS 0GILF (16086* 0SHJ *P (16086* &WVK

*HQHV

3LNDS *P &[FU



$GDSRV 0\RI (16086*

=VFRUH

(16086*

&WV] (16086* .ON (16086* *P *P (16086* (16086*



&G *SQPE ;GK (16086* (16086* *P &E )WK (16086* 6OFD &VIU



/\D )DES (16086* (16086* $GJUH +5LN )NES &TE $JW &TD (16086* (16086*



(16086* (16086* *P /FQ *P (16086* $SRH 5XQ[ )5LN '5LN *P



&VPGRV (16086* &PWP (16086*

6  \ D '

'

D

\



B

+ B

1

6

6 B \ D '

\ D '



 



B

1

6 +

6 1 B  \ D '

'

D

\



B

+

6

*DOQW

7LPH3RLQWî&RQGLWLRQ

Figure 17: Global DEG heat map of mouse SCI dataset compared with time point and NS/HS.

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

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

(A)

(B)

(C)

Figure 18: Gene Ontology (GO) enrichment analysis of differentially expressed genes. (A) Enriched biological processes for downregulated (left) and upregulated (right) genes in Astrocytes (Astro-NT). (B) Enriched pathways in Microglia, highlighting the downregulation of regulatory functions and upregulation of axonogenesis-related processes. (C) Functional categorization of key pathways, distinguishing between function loss (e.g., Myelination) and aberrant activation (e.g., Neuron Projection Guidance). The x-axis represents the statistical significance (-log10 P-value).

Related documents

Record · ID 349673 · SHA-256 33f686d2db103c9b
Retrieved via Conceptio: every document is proof-bundled with source, license, and retrieval metadata.
Bring this data into your agent: Connect via MCP or API · 20 free credits to start · no card required
Read the Docs → · View CLI source on GitHub · Conceptio Open Knowledge Archive