SpaCellAgent: A Self-Evolving LLM-Based Multi-Agent Framework for Trajectory Analysis¶
๐ Published (v1): 2026-07-08 14:31 UTC ยท Source: Arxiv ยท link
Ask a follow-up
Open an assistant pre-loaded with this paper's context.
๐ฌ Ask ChatGPTโฆ Ask Claude
TL;DR¶
SpaCellAgent is an LLM-driven multi-agent framework that automates end-to-end trajectory inference (TI) for single-cell and spatial transcriptomics data, replacing expert-driven, tool-fragmented workflows with a self-evolving orchestration pipeline. It decomposes user natural-language queries into executable steps, dynamically selects and registers bioinformatics tools, and iteratively refines outputs through dual-layer biological and syntactic validation. On six heterogeneous datasets it achieves a 41.2% reduction in analysis time while matching expert-level trajectory quality.
Problem¶
Trajectory inference methods (Monocle, Slingshot, PAGA, DPT) are grounded in incompatible mathematical frameworks โ graph abstraction, principal curves, diffusion maps โ and perform inconsistently across data dimensionalities and trajectory topologies. Analysts must manually select methods, tune hyperparameters, and interface with heterogeneous Python/R ecosystems, creating a steep expertise barrier, poor reproducibility, and analytical inefficiency. No prior framework provides an end-to-end, closed-loop, self-improving solution for both scRNA-seq and spatially-resolved tissue data.
Method¶
SpaCellAgent instantiates four specialized LLM agents (all backed by DeepSeek-V3, temperature 0.0 for deterministic outputs, 0.4 for reflection):
- Planner: Ingests the natural-language query and a structured dataset metadata profile (gene count matrix \(\mathbf{X} \in \mathbb{R}^{N \times G}\), spatial coordinate matrix \(\mathbf{S} \in \mathbb{R}^{N \times D}\), sparsity, modality flags) and emits a JSON-encoded directed action sequence.
- Executor: Contains a Tool Selector (semantic router over a curated + dynamically expanding registry of Python/R TI packages) and a Coder (polyglot script generator that serializes AnnData/SpatialData objects and passes pseudotime \(\boldsymbol{\tau}\) between environments).
- Evaluator: Dual-layer โ a Code Evaluator inspects execution logs for runtime exceptions and API errors; a Biological Evaluator cross-references inferred trajectories against biological priors (e.g., flagging terminally-differentiated cells misassigned as root). When outside its experience distribution, a knowledge-augmented fallback queries PubMed for tissue-specific markers.
- Reporter: Synthesizes visual outputs and biological interpretations into a final narrative.
Self-refinement runs a bounded retry loop per step: failures route error logs and evaluator feedback back to the Coder with prompts enforcing strategy divergence to prevent repetition. Self-evolution archives verified code snippets and error-fix pairs into a global memory repository; new tasks retrieve relevant templates via retrieval-augmented generation (RAG). Dynamic tool discovery allows the system to import previously unseen packages at runtime and register them after successful biological validation.
Key Contributions¶
- End-to-end LLM multi-agent framework mapping natural-language TI queries to executable scRNA-seq and spatial transcriptomics workflows with automated report generation.
- Dynamic tool orchestration engine that adaptively selects among heterogeneous TI algorithms (Monocle, PAGA, Slingshot, DPT, SpaceFlow, STORIES) based on dataset characteristics rather than static defaults.
- Dual-layer memory architecture (local ephemeral context buffer + global persistent knowledge base) enabling cross-task self-evolution via RAG over verified workflows and error-fix pairs.
- Knowledge-augmented fallback that retrieves peer-reviewed PubMed references when encountering out-of-distribution TI tasks.
- Dynamic tool discovery and registration: novel packages are imported at inference time, validated biologically, and added to the growing registry.
Results¶
- 41.2% reduction in analysis time compared to manual expert workflows across six datasets.
- ">40% improvement in analytical efficiency" reported overall.
- Evaluated on six heterogeneous datasets: REAL-GOLD, REAL-SILVER, SYNTHETIC benchmarks from the dynverse suite, Mouse Dorsal Midbrain (spatial), Axolotl Neuron Regeneration (spatial), and an unpublished Mouse Spinal Cord Injury dataset.
- Baselines include DPT, RaceID/StemID, Monocle, Slingshot, and PAGA (five established methods spanning diffusion-based, clustering-based, MST, principal-curve, and graph-abstraction paradigms).
- Quantitative per-dataset table (Table 1) is truncated in the provided text; headline claim is "outperforms state-of-the-art baselines in topological fidelity."
Limitations¶
- All experiments use a single backbone LLM (DeepSeek-V3); generalization across other LLMs is untested.
- The self-evolution global memory benefits from accumulated prior runs; cold-start performance on the first dataset of a new tissue type relies on PubMed fallback rather than internal experience.
- The maximum retry budget per step is bounded; if all attempts fail, the workflow halts without a recovery path beyond the step limit.
- The biological evaluator relies on LLM cross-referencing with biological priors โ errors in the LLM's biological knowledge propagate undetected unless caught by PubMed fallback.
- Results table is partially truncated in the available preprint; per-metric breakdowns across all six datasets are not fully visible.
Relevance to Harnesses / Meta-Harnesses¶
SpaCellAgent is a domain-specialized meta-harness: it wraps a heterogeneous ecosystem of existing TI tools behind a planning-execution-evaluation-reporting agent loop, making tool selection and pipeline composition automatic rather than hand-coded. The dual-layer memory and dynamic tool registration are direct implementations of the self-evolving meta-harness pattern โ the harness itself grows its tool registry and knowledge base over successive runs without human curation. The RAG-over-verified-workflows pattern (global memory โ new task bootstrapping) is directly transferable to general meta-harness design. The separation of syntactic validation (code evaluator) from semantic validation (biological evaluator) is a concrete architecture for domain-aware quality gates inside a harness loop.