ScriptSmith: A Unified LLM Framework for Enhancing IT Operations via Automated Bash Script Generation, Assessment, and Refinement

Pooja Aggarwal, Oishik Chatterjee, Ting Dai, Suranjana Samanta, Prateeti Mohapatra, Debanjana Kar, Ruchi Mahindru, Steve Barbieri, Eugen Postea, Brad Blancett, Arthur De Magalhaes

Abstract

Site Reliability Engineers (SREs) rely heavily on Bash scripts for incident remediation, yet manual script creation is error-prone and time-consuming. ScriptSmith is a novel, execution-free framework designed to automate the end-to-end lifecycle of these scripts. By combining Large Language Model (LLM) generation with a "peer-review" assessment and refinement loop, ScriptSmith enhances script accuracy by up to 10% without the need for a live, pre-configured testing environment.

Introduction

In IT operations (ITOps), automating incident remediation through Bash scripts is a critical but labor-intensive task. While LLMs have shown promise in code generation, traditional evaluation benchmarks like HumanEval rely on execution-based testing. This approach is often impractical for system-level scripts due to the lack of safe, pre-configured sandboxes and the dynamic nature of system contexts (e.g., fluctuating CPU load), which makes static input-output assertions unreliable. ScriptSmith addresses these challenges by enabling script generation, assessment, and correction "on paper" before deployment.

Methodology

The ScriptSmith framework utilizes a multi-stage pipeline to ensure script reliability:

  1. Catalogue Retrieval: The system first queries a database of verified, human-approved scripts.
  2. Initial Generation: If no match exists, a code-centric LLM generates a script from a natural language prompt.
  3. Execution-Free Assessment (CodeSift): An LLM-based evaluator performs logic analysis, comparing the task description with the generated code's logic without executing it.
  4. Automated Refinement: If flaws are detected, an "Error Explanation LLM" provides a natural language diagnosis, which the generator uses to produce a corrected version.
The ScriptSmith pipeline for script generation, assessment, and refinement.

A significant innovation in ScriptSmith is the Peer-Review mechanism. By using a smaller, specialized model (e.g., Llama3-8B) to assess the output of a larger model (e.g., Llama3-70B), the framework mitigates "self-bias," where a model fails to recognize its own logical errors.

Datasets and Evaluation

The framework was evaluated using two primary datasets: CodeSift (100 tasks for reference-less evaluation) and InterCode (153 tasks). Additionally, a human expert study involving four domain experts provided a "gold standard" for accuracy, comparing ScriptSmith's performance against automated metrics and traditional execution-based results.

Key Results

ScriptSmith demonstrated a consistent performance boost across various models and datasets. The refinement loop provided an overall accuracy improvement of 7–10%.

Performance comparison of different LLMs on Bash datasets showing accuracy improvements after refinement.

Key findings include:

  • Accuracy Gains: On the InterCode dataset, Llama3-70B's accuracy improved from 42% to 52%. Gemini 1.5 Pro achieved 84% accuracy on the CodeSift dataset.
  • Human Alignment: Experts validated that model-generated feedback was correct in 69% of cases, and the model successfully applied this feedback to fix scripts 77% of the time.

Discussion and Insights

The study revealed several critical insights into LLM-driven code automation:

  • The "Self-Bias" Trap: Models are often ineffective at grading their own outputs. Peer-review by smaller models yielded superior refinement results compared to self-reflection.
  • Flaws in Execution Accuracy (EA): Traditional testing often penalizes correct scripts due to rigid environment expectations (e.g., failing a script because it includes descriptive text alongside a correct IP address).
  • The Danger of Self-Doubt: If a model is asked to "fix" an already correct script, it may hallucinate errors, leading to broken code. Implementing "guardrails" is essential to prevent such regressions.

Conclusion

ScriptSmith represents a significant step toward safe, automated ITOps. While the framework currently faces limitations regarding catalogue size and feedback verbosity, future work will focus on expanding the knowledge base and exploring "controlled execution" environments to further enhance reliability.

Summary updated

BibTeX
@inproceedings{aggarwal2025scriptsmith,
  author = {Pooja Aggarwal and Oishik Chatterjee and Ting Dai and Suranjana Samanta and Prateeti Mohapatra and Debanjana Kar and Ruchi Mahindru and Steve Barbieri and Eugen Postea and Brad Blancett and Arthur De Magalhaes},
  title = {{ScriptSmith: A Unified LLM Framework for Enhancing IT Operations via Automated Bash Script Generation, Assessment, and Refinement}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i28.35147},
}
Figure