Skip to content

Script Builder AI

The Script Builder AI is an inline AI assistant embedded in the Breeze script editor. It uses a conversational interface to help you write, modify, and test scripts through natural language. The assistant has access to your device fleet, existing script library, alert data, and script execution history — giving it the context it needs to generate scripts tailored to your environment.

Script Builder AI sessions stream responses via Server-Sent Events (SSE), support tool approval workflows for device execution, and can directly apply code and metadata changes to the editor without copy-paste.


The Script Builder AI maintains a conversational session with full context about the script you are editing. When you send a message, the AI can:

  • Read the current editor state (code, language, parameters, OS targets)
  • Query your device fleet to tailor scripts to specific hardware or OS versions
  • Search your existing script library to avoid duplicates or build on prior work
  • Browse script templates for common tasks
  • Write code directly into the editor via the apply_script_code tool
  • Update script metadata (name, description, category, parameters) via apply_script_metadata
  • Execute saved scripts on devices (with your explicit approval)

Script Builder sessions are distinct from general Breeze AI sessions. They are scoped to the script_builder type and have access to a curated set of tools specific to script authoring.

AttributeValue
Session typescript_builder
Streaming protocolServer-Sent Events (SSE)
Max message length10,000 characters
Editor snapshot sizeUp to 500,000 characters
Auto-generated titleFirst message, truncated to 80 characters
LanguageExtensionDescription
powershell.ps1Windows PowerShell and cross-platform PowerShell Core
bash.shBash shell scripts for macOS and Linux
python.pyPython scripts (cross-platform)
cmd.batWindows command prompt batch files

The AI can infer and set script parameters with these types:

TypeDescription
stringFree-form text input
numberNumeric input
booleanTrue/false toggle
selectDropdown with predefined options
LevelDescription
systemRuns as the agent service account
userRuns in the context of a connected user session
elevatedRuns with root/administrator privileges

  1. Open the Script Editor in the Breeze dashboard.
  2. Click the AI Assistant button to open the Script Builder panel.
  3. A new session is created automatically. If you are editing an existing script, the editor context is attached to the session.
  4. Type your request in natural language. For example: “Write a PowerShell script to clean up temp files older than 30 days on Windows endpoints.”

The AI maintains conversation history within a session, so you can refine scripts through follow-up messages:

  1. Ask the AI to generate an initial script.
  2. Review the code that appears in the editor.
  3. Request changes: “Add error handling and logging” or “Make it also clean the Recycle Bin.”
  4. The AI applies updates directly to the editor.
  5. Ask the AI to set metadata: “Set the category to Maintenance, target Windows, and add a parameter for the age threshold in days.”

The execute_script_on_device tool is a Tier 3 tool, meaning it requires explicit user approval before it runs.

  1. Save the script in the editor.
  2. Ask the AI: “Run this script on my Windows test devices.”
  3. The AI sends an approval request with the script ID and target device IDs.
  4. Review the request and click Approve or Deny.
  5. If approved, the script executes and results are streamed back to the conversation.

If the AI is generating a long response or executing a chain of tool calls, you can interrupt it:

  1. Click the Stop button in the AI panel.
  2. The current response is halted and the session returns to idle.
  3. Send a new message to continue the conversation.

The Script Builder has access to 10 tools organized by function and safety tier.

These tools write directly to the script editor. They do not execute any code on devices.

ToolDescription
apply_script_codeReplaces the script code in the editor with AI-generated content. Requires a code string and language identifier.
apply_script_metadataUpdates editor form fields: name, description, category, OS types, parameters, runAs level, and timeout. Only fields included in the call are changed.

These read-only tools give the AI awareness of your environment.

ToolDescription
query_devicesSearch devices by status, OS type, or hostname. Used to tailor scripts to your fleet.
get_device_detailsGet full device details including hardware, OS, network, and installed software.
manage_alertsQuery active alerts to understand what issues a script should address.
list_scriptsSearch the existing script library by name, category, language, or OS.
get_script_detailsGet full script details including code, parameters, and execution settings.
list_script_templatesBrowse available script templates for common tasks.
get_script_execution_historyView past execution results for a script to understand success rates.

Execution Tool (Tier 3 — Requires Approval)

Section titled “Execution Tool (Tier 3 — Requires Approval)”
ToolDescription
execute_script_on_deviceRun a saved script on one or more devices (up to 10 at once). Requires user approval before execution.

The Script Library is a centralized repository for organizing, versioning, and sharing scripts within your organization. It complements the AI assistant by providing a structured catalog that the AI can reference and build upon.

Categories group scripts by function. Each organization manages its own set of categories.

FieldRequiredMax LengthDescription
nameYes100Category name (unique per organization)
descriptionNo500Description of the category
colorNo20Display color (e.g., #E9C46A)

Tags provide flexible cross-cutting labels. Unlike categories (one per script), a script can have multiple tags.

FieldRequiredMax LengthDescription
nameYes50Tag name (unique per organization)

Templates are starter scripts for common tasks. They define a language, compatible OS types, and boilerplate code. Users create new scripts from templates with custom names and descriptions.

Every script tracks its version number. When you update a script’s code, the previous version is saved as a snapshot. You can view the full version history and roll back to any previous version.

OperationDescription
Create versionSaves the current code as a snapshot and updates the script with new content
List versionsReturns the complete version history, newest first
RollbackRestores the script to a previous version’s content, creating a snapshot of the current state

Each script tracks execution metrics automatically:

MetricDescription
totalRunsTotal number of executions
successCountExecutions that completed with exit code 0
failureCountExecutions that failed
averageDurationSecondsAverage execution time
lastRunAtTimestamp of the most recent execution
lastRunStatusStatus of the most recent execution
recentRunsList of recent execution records with timestamps and durations

All endpoints require authentication and organization, partner, or system scope. Mounted at /api/v1/ai/script-builder.

MethodPathDescription
POST/sessionsCreate a new Script Builder AI session
GET/sessions/:idGet session details with message history
DELETE/sessions/:idClose a session
POST/sessions/:id/messagesSend a message and receive an SSE stream
POST/sessions/:id/interruptInterrupt an active AI response
POST/sessions/:id/approve/:executionIdApprove or deny a tool execution request

All endpoints require authentication and organization, partner, or system scope. Mounted at /api/v1/script-library.

MethodPathDescription
GET/categoriesList all categories
POST/categoriesCreate a category
GET/categories/:idGet a category
PATCH/categories/:idUpdate a category
DELETE/categories/:idDelete a category
GET/tagsList all tags
POST/tagsCreate a tag
DELETE/tags/:idDelete a tag
GET/templatesList templates (optional categoryId or category filter)
POST/from-template/:templateIdCreate a new script from a template
GET/scripts/:id/versionsList version history for a script
POST/scripts/:id/versionsCreate a new version (save current, update content)
POST/scripts/:id/rollback/:versionIdRoll back to a previous version
GET/scripts/:id/usage-statsGet execution statistics for a script

When you send a message to a Script Builder session, the response is streamed as Server-Sent Events. Each event has a type field:

Event TypeDescription
textPartial text content from the AI response
tool_useThe AI is calling a tool (includes tool name and arguments)
tool_resultResult returned from a tool execution
title_updatedSession title was auto-generated from the first message
doneThe AI has finished its response
errorAn error occurred during processing

”A message is already being processed for this session” (409)

Section titled “”A message is already being processed for this session” (409)”

Only one message can be processed at a time per session. Wait for the current response to complete or use the interrupt endpoint before sending a new message.

The session may have been closed or expired. Script Builder sessions share the same lifecycle as general AI sessions. Create a new session to continue.

The AI pre-flight check enforces rate limits and token budget caps. If you see a 429 (rate limit) or 402 (budget exceeded) error, wait before retrying or contact your administrator to adjust budget limits.

The execute_script_on_device tool is the only Tier 3 tool in the Script Builder. If an approval prompt does not appear, verify that the AI’s response includes an approval request event in the SSE stream.

Ensure the script has been saved (has a valid script ID) and that the target devices are online and accessible. The AI will report execution results or errors back in the conversation.

Category and tag names must be unique within an organization. If you receive a 409 conflict, choose a different name or update the existing entry.