Papers
Topics
Authors
Recent
Search
2000 character limit reached

SasAgent: Multi-Agent SAS Analysis

Updated 25 May 2026
  • SasAgent is a multi-agent AI system that automates small-angle scattering analysis by integrating LLM-driven workflows with specialized SasView tool wrappers.
  • It employs a two-layer architecture where a coordinator agent directs expert agents for SLD calculation, synthetic data generation, and experimental data fitting.
  • The platform delivers rigorous, reproducible results via a Gradio-based interface, achieving fast analysis speeds and statistically robust fits.

SasAgent is a multi-agent AI system designed to automate and streamline small-angle scattering (SAS) data analysis by integrating LLMs and LLM-adapted tools from the SasView software suite. The platform enables entirely natural-language-driven workflows for scattering length density (SLD) calculations, synthetic data generation, and experimental data fitting. Through layered, specialized agent interactions, SasAgent offers rigorous, reproducible SAS analysis and facilitates user interaction via a Gradio-based graphical interface (Ding et al., 4 Sep 2025).

1. System Architecture and Multi-Agent Workflow

The SasAgent architecture consists of a two-layer agent system: one top-level coordinator agent mediates all user interaction, delegating specific tasks to three expert agents, each responsible for a distinct analytic function. These agents leverage LLM-friendly wrappers around the core SasView Python APIs. The architecture is organized as follows:

  • Coordinator Agent: Serves as the sole entry point for natural-language input. It parses the user prompt using a text-classification chain to determine intent. Potential intents are (1) SLD calculation, (2) synthetic data generation, or (3) experimental data fitting.
  • Expert Agents:
    • SLD Agent: Computes real and imaginary components of SLD using the SLD calculator tool.
    • Generation Agent: Produces synthetic I(q) scattering curves by invoking the Model Data Tool and optionally the Retrieval-Augmented Generation (RAG) documentation tool.
    • Fitting Agent: Performs parameter estimation on uploaded experimental data, orchestrating calls to the SLD calculator, RAG documentation tool, and bump-fitting tool.
  • Tools Layer (wrappers for SasView Python API):
  1. Model Data Tool
  2. RAG Documentation Tool (indexed over 78 SasView model docs)
  3. Bump Fitting Tool
  4. SLD Calculator Tool

The coordinator agent aggregates all outputs—numerical results, fit statistics, and plots—into a unified response within a conversational chat interface.

Data Flow and Decision Logic (Pseudocode):

VV5 This architecture enables direct, reproducible transformations from natural-language prompts to scientifically rigorous SAS analyses (Ding et al., 4 Sep 2025).

2. Mathematical Bases: SLD, I(q), and Optimization Criteria

SasAgent operationalizes standard mathematical formulations central to SAS data analysis.

  • Scattering Length Density (SLD):

ρ=ibiV\rho = \frac{\sum_i b_i}{V}

  • bib_i: Bound coherent scattering length of nucleus ii (meters).
  • VV: Molecular volume (Å3^3 or nm3^3, consistent units).
  • Outputs: ρreal\rho_\mathrm{real} (cm2^{-2} or Å2^{-2}), ρimag\rho_\mathrm{imag} (absorption component).
    • Small-Angle Scattering Intensity bib_i0:

bib_i1

  • bib_i2: Form factor amplitude determined by the chosen model (e.g., sphere, cylinder).
  • bib_i3.
    • Fitting Objective Functions:
  • Chi-square:

    bib_i4

  • Log-Likelihood (Gaussian noise):

    bib_i5

    • Bump Fitting Tool Optimization:
  • Utilizes Levenberg–Marquardt or trust-region methods (as implemented in SasView).
  • Workflow: SLD parameters fixed, parameter bounds from RAG docs, initial guesses specified, optimization executed, best-fit parameters and covariance matrix returned.

This mathematical rigor ensures that downstream analyses and fits are consistent with established SAS standards (Ding et al., 4 Sep 2025).

3. LLM-Adapted SasView Tool Wrappers

The system operationalizes four LLM-friendly API wrappers, each reflecting a specialized aspect of SAS analysis:

Tool Name Inputs Outputs
Model Data Tool Model name, parameter dict, bib_i6-range, number of points Array of bib_i7 pairs
RAG Documentation Model name, query text Extracted parameter/unit documentation
Bump Fitting Tool Experimental data bib_i8, model, initial guess Fitted parameters bib_i9, ii0, residue, fit curve
SLD Calculator Tool Formula/sample name, density, wavelength (optional) ii1, ii2
  • Model Data Tool: Thin wrapper over SasView’s calculate_Iq() to simulate scattering curves given model and parameter inputs.
  • RAG Documentation Tool: Indexes SasView HTML documentation (via BeautifulSoup, vector DB) for contextual model parameter information.
  • Bump Fitting Tool: Interfaces with SasView’s Fit.execute_bump_fit(...), facilitating parameter estimation and uncertainty quantification.
  • SLD Calculator Tool: Leverages SasView’s sld_calculator() to compute sample- or solvent-specific SLDs.

This layered abstraction allows seamless LLM-driven orchestration over complex SAS tasks (Ding et al., 4 Sep 2025).

4. Workflow Examples and Precision Assessment

SasAgent supports end-to-end scientific workflows, demonstrated by the following scenarios:

  • SLD Calculation:
    • Prompt: "Compute SLD of D₂O at 25 °C."
    • Process: Coordinator → SLD Agent → SLD tool with (D₂O, 1.11 g/cm³).
    • Result: ii3 Åii4, ii5 (negligible).
  • Synthetic Data Generation:
    • Prompt: "Simulate SANS for a flexible polymer chain, length=50 nm, Kuhn length=2 nm, ii6."
    • Process: Coordinator → Generation Agent → (RAG: model selection “FlexibleCylinder”) → Model Data Tool.
    • Result: I(q) curve covering requested ii7-range with specified parameters.
  • Experimental Data Fitting:
    • Prompt: SANS data upload, request for sphere radius fit with fixed solvent SLD.
    • Process: Coordinator → Fitting Agent → (SLD tool for D₂O, RAG for parameter names, bump-fitting tool with initial radius).
    • Result: ii8 nm, ii9, computation VV0 seconds on single CPU.

These examples reveal fit residuals near statistical limits (VV1), demonstrating the sufficiency of the toolchain for typical SAS analyses (Ding et al., 4 Sep 2025).

5. User Interface and Interaction Paradigms

SasAgent exposes its capabilities through a Gradio-based UI optimized for clarity, auditing, and reproducibility:

  • Chat Window: Accepts natural-language prompts and displays multimodal agent replies (numerics, text, plots).
  • System Logs: Reports coordinator/agent tool invocations for workflow transparency.
  • Settings: API key interface and choice of LLM backend (gpt-4o, gpt-5, Claude Sonnet-4, Gemini, etc.), facilitating cost-performance tradeoffs.
  • Plot Display: Interactive rendering of I(q) curves, fit overlays; hover tooltips reveal trace details.
  • Data Upload: Drag-and-drop for experimental datasets.
  • Usability Features:
    • Pre-populated example prompts for each workflow.
    • Downloadable outputs (CSV: best-fit parameter vectors, residuals).
    • Live orchestration logs to support debugging and fine-grained method auditing.

This user-centric design, coupled with agent modularity, allows both non-experts and domain specialists to utilize advanced scripting-free SAS workflows (Ding et al., 4 Sep 2025).

6. Significance and Research Trajectory

SasAgent demonstrates that a two-layer, multi-agent LLM system—built atop modular, LLM-adapted scientific tool wrappers—can automate the full SAS analytic pipeline, from raw user prompts to parameter estimation and hypothesis-driven synthetic experiment generation. The platform exemplifies how state-of-the-art LLMs can interface with legacy scientific software, producing outputs with mathematical rigor, transparency, and operational speed (typical analysis VV215 s per dataset, VV3 performance benchmarked at VV4).

A plausible implication is that such systems will further accelerate the adoption of autonomous scientific workflows, lowering the barrier to complex analyses, enhancing reproducibility, and enabling advanced forms of research collaboration without manual intervention (Ding et al., 4 Sep 2025).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to SasAgent.