TLDR: This paper introduces CTAgent, an AI agent powered by large language models (LLMs), designed to assist in developing and maintaining the Cherenkov Telescope Array Observatory’s (CTAO) control software (ACADA). CTAgent ingests various document types, synthesizes executable Pydantic models, and iteratively validates and repairs its own code output. This approach aims to reduce boilerplate coding, improve reliability, and streamline workflows for CTAO engineers by automating the creation of strongly-typed Python data models.
The Cherenkov Telescope Array Observatory (CTAO) is a groundbreaking project that relies on complex control and data acquisition software. Developing and maintaining this software, known as ACADA, requires deep expertise, involves repetitive coding tasks, and demands strict adherence to project standards. This often consumes significant time and resources from engineers.
To address these challenges, researchers have introduced an innovative solution: AI agents powered by large language models (LLMs). These agents are specifically designed to assist in the engineering and operation of the CTAO’s ACADA software. The core idea is to leverage the advanced capabilities of LLMs, which have matured significantly in assisting with software engineering tasks, especially when provided with relevant project context and clear, verifiable objectives.
The paper introduces a specific LLM-assisted agent called CTAgent. This agent is built to perform several key functions:
What CTAgent Does
- It can process various types of CTAO documents and data, including plain text, JSON, LaTeX, PDF, and DOCX files.
- It can then create executable Pydantic models that accurately reflect the structure of this ingested information.
- Crucially, CTAgent can iteratively validate and fix its own output until the generated code compiles correctly and meets basic schema requirements.
CTAgent is designed with practical goals in mind: to reduce the time engineers spend on creating and maintaining data models, to provide a clear and testable method for converting diverse specifications into strongly-typed Python code, and to identify where these agentic workflows can offer the most value within CTAO operations and data analysis pipelines.
How CTAgent Works: The Architecture
The agent follows a “narrow-waist” design, meaning local components handle routine tasks like file input/output, basic checks, and configuration, while the LLM agents focus on their primary task: generating valid Python code for Pydantic models. The process involves several steps:
- A component called `FileIngestor` converts all input files (TXT, DOCX, PDF, JSON) into a standardized UTF-8 text format, making the agent robust and stateless.
- Specialized LLM experts, tailored to different file types, propose initial code.
- An orchestrator then validates this proposed code using techniques like AST parsing (checking the abstract syntax tree) and structural checks (ensuring a class and `BaseModel` are present).
- If the code is invalid, the orchestrator creates a targeted prompt detailing the specific issues (e.g., syntax errors, missing imports) and sends it to a dedicated `CodeImprover` agent.
- The `CodeImprover` agent then returns corrected, complete code, and this loop continues for a set number of attempts until valid code is produced or a failure is reported.
The system also includes utilities for generating synthetic models for testing and demonstrations, and a `ConfigurationWrapper` to illustrate how these generated models could integrate with ACADA connectors.
Also Read:
- Enhancing API Creation with AI: A New Approach Combining Prompt Optimization and Reinforcement Learning
- Navigating the Future of Software Testing with Large Language Models: A Research Roadmap
Conclusion and Future Outlook
The research demonstrates that these domain-aware, validation-first agents are already practical for tasks within the CTAO. By focusing on generating strongly-typed Pydantic models, performing local execution and checks, and providing specific error feedback, the system significantly reduces boilerplate code and enhances reliability for common workflows. This approach aligns with principles validated in previous work on agentic code generation for other astronomy frameworks like Gammapy.
The agents are built with open-weight models, allowing for on-premise and privacy-preserving deployments. Currently, they are being evaluated on the Helmholtz Blablador platform using OpenAI’s GPT-OSS series. Future plans include further aligning the agents with CTAO’s specific documentation and evolving codebase, connecting them to operational external APIs (for telemetry, configuration, and CI/CD), and integrating these capabilities more deeply into CTAO pipelines for both operations and offline analysis. This integration of an embedded ACADA corpus with open-weight LLM backends promises advanced semantic search, automated code and data-model synthesis, and project-specific quality assurance. You can read the full paper for more technical details here: Enhancing the development of Cherenkov Telescope Array control software with Large Language Models.


