TopoAgent: An Agentic Framework for Automated Topology Learning in Medical Imaging

Guangyu Meng, Pengfei Gu, Xueyang Li, Yiyu Shi, Erin Wolf Chambers, Danny Z. ChenarXiv 2026

TL;DR

TopoAgent is the first LLM-based agentic framework designed to automate Topological Data Analysis (TDA) for medical imaging. By utilizing a specialized reasoning loop and a distilled expert "skill set," it automatically selects and configures the best topological descriptors for a given image, outperforming general-purpose LLMs and fixed-descriptor baselines by over 21% and 9%, respectively.

What Problem Does This Paper Address?

Topological Data Analysis (TDA), particularly Persistent Homology (PH), is a powerful tool for medical imaging. It captures structural features—like the branching of blood vessels, the arrangement of cells, or the loops in glandular tissue—that standard pixel-level deep learning often misses.

However, TDA has a "usability" bottleneck. To use PH in a machine learning pipeline, you must convert complex persistence diagrams into fixed-length feature vectors using "topological descriptors." There are dozens of these descriptors (e.g., Persistence Images, Betti Curves, Minkowski Functionals), and no single descriptor works best for every dataset. Currently, choosing the right one requires a TDA expert to perform extensive manual trial-and-error.

The authors address this by asking: Can we build an AI agent that reasons about an image's morphology and automatically picks the best topological tool for the job?

Methods

The authors introduce TopoAgent, which operates via a Perception–Reasoning–Action–Reflection (PRAR) loop. Unlike a simple chatbot, this agent is equipped with a library of 21 domain-specific tools and a specialized knowledge base.

Fig. 2: An overview of the TopoAgent framework with four phases: Perception iden- tifies the object type and analyzes persistent homology statistics; Reasoning proposes and determines the descriptor and parameters; Action calls the descriptor tools; Re- flection validates the feature vector. The skill set S feeds descriptor properties and tiered rankings with parameters to Reasoning (dashed green). Short-term memory Ms tracks execution history within a run; long-term memory Ml supplies diagnostic entries to Reasoning (dashed orange) and is updated on failure.

Key Components:

  • The PRAR Loop:
    • Perception: The agent uses tools to extract a "topological profile" (e.g., Betti ratios, persistence statistics) and identifies the object type (e.g., "vessel tree").
  • Reasoning: A two-step process where the agent first proposes a descriptor based on mathematical properties and then refines that choice using empirical evidence.
  • Action: The agent calls the specific TDA tool with optimized parameters.
  • Reflection: The agent inspects the resulting feature vector for quality issues (like excessive sparsity) and retries if necessary.
  • The Skill Set ($S$): This is the "brain" of the agent, containing distilled knowledge from a systematic evaluation of 15 descriptors across 26 datasets. It includes qualitative properties, tiered rankings, and validated hyperparameter ranges.
  • Dual Memory: A short-term memory tracks actions within a single run, while a long-term memory allows the agent to learn from failures across different images in the same dataset.
  • Anti-Anchoring Design: To prevent the LLM from blindly following rankings (acting as a simple lookup table), the authors hide the empirical rankings during the initial "Proposal" phase, forcing the agent to reason independently first.

Datasets

The authors introduce TopoBenchmark, a massive, standardized testbed for TDA in medical imaging.

  • Scale: 113,182 samples across 26 datasets.
  • Diversity: Covers 11 imaging modalities and 5 distinct morphological categories: cells, glands/lumens, organ shapes, vessel trees, and surface lesions.
  • Purpose: It provided the empirical data used to distill the TopoAgent Skill Set and serves as a frozen benchmark for evaluation.

Key Insights and Ideas

  • No Universal Winner: The paper confirms that the "best" descriptor varies wildly. For example, Minkowski Functionals might excel at skin lesions, while Persistence Statistics are better for glandular tissue (see Figure 1a).
  • LLMs Need Grounding: General-purpose LLMs (like GPT-4o or Claude) fail at TDA tasks even when given the tools because they lack "empirical grounding"—they don't know which mathematical properties actually translate to high classification accuracy in practice.
  • Visual + Topological Synergy: The agent performs best when it "sees" both the raw image and the abstract topological summary. This helps it distinguish between visually similar but topologically different structures, like dense cell clusters vs. fragmented lumen boundaries.
  • Interpretability: Unlike "black-box" deep learning features, the descriptors TopoAgent selects (like Minkowski functionals) provide interpretable geometric signatures like area, perimeter, and Euler characteristics.

Key Results

  • Superior Accuracy: TopoAgent achieved 68.21% average balanced accuracy across the benchmark.
  • Outperforming Baselines: It beat the strongest non-adaptive baseline (an "oracle" that always picks the best descriptor for a specific object type) by 9.32%.
  • Agentic Advantage: It outperformed general-purpose LLMs equipped with the same tools by over 21%, proving that the PRAR framework and Skill Set are essential.
  • Downstream Integration: When TopoAgent's features were fused with standard backbones (ResNet-152, SwinV2-B), it matched or exceeded the performance of state-of-the-art learnable topology layers (like PHG-Net) without requiring task-specific training.
Comparison of reasoning traces: TopoAgent correctly identifies the need for Persistence Statistics for glands/lumens, whereas other LLMs select sub-optimal descriptors.

Limitations and Future Work

  • Dimensionality: Currently, the framework and benchmark are limited to 2D images. Extending this to 3D volumetric data (like CT or MRI scans) is a logical next step.
  • Latency: The agentic loop is relatively slow, taking about 32 seconds per image due to multiple LLM calls. While practical for batch processing, it is not yet suitable for real-time applications.
  • Domain Specificity: The current Skill Set is distilled from medical images. Using TopoAgent for other fields (like materials science or satellite imagery) would require a new round of knowledge distillation.
  • Multi-Descriptor Fusion: Future versions could explore using the agent to combine multiple descriptors for even richer feature sets.

Summary updated

Abstract

Topological data analysis (TDA), particularly persistent homology (PH), captures geometric structural properties in medical images (e.g., connected components, loops, shape characteristics), which conventional pixel-level deep learning approaches often neglect. While many topological descriptors are known for converting persistence diagrams (PDs) or raw images into topological feature vectors, existing methods mostly default to a single fixed descriptor (e.g., persistence images), leaving the diversity of topological representations largely unexplored. To the best of our knowledge, there is no known large language model (LLM)-based agentic framework that can automatically determine the most suitable topological descriptors for a given image dataset and produce the corresponding topological feature vectors for downstream tasks. To fill this gap, we propose \textbf{TopoAgent}, an LLM-based agentic framework that automates topology learning for medical image analysis.TopoAgent operates through a Perception--Reasoning--Action--Reflection loop supported by 21 domain-specific tools and dual memory that accumulates experience across runs. Its skill set is distilled from systematic evaluation of 15 topological descriptors across 26 datasets with six classifiers. TopoAgent analyzes input images and their topological characteristics, reasons about which topological descriptors best suit the input, and determines the optimal descriptor and its configuration, all without task-specific training.
BibTeX
@misc{meng2026topoagent,
  author = {Guangyu Meng and Pengfei Gu and Xueyang Li and Yiyu Shi and Erin Wolf Chambers and Danny Z. Chen},
  title = {{TopoAgent: An Agentic Framework for Automated Topology Learning in Medical Imaging}},
  year = {2026},
  eprint = {2606.29763},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.29763},
}
Figure