---
sourceDocument: Xanadu Enable AI
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/intelligent-experiences

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu Enable AI

ft:clusterId :

    - platai

bundleId :

    - platai

workflow :

    - Platform


---

# Script

# Add a script to an AI agent {#ariaid-title1}

* Release version: Xanadu
* 
* Updated January 30, 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

Create a script to add it to an AI agent in AI Agent Studio. With scripts, you can use the scriptable APIs and back-end integration to support the AI agent.

## Before you begin

Role required: sn_aia.admin

## Procedure

1. Navigate to AllAI Agent StudioCreate and manageAI agents.
2. Open the AI agent that you want to add a script to and navigate to the Add tools and information section.
3. In the Add tool drop-down list, select Script.
4. On the form, fill in the fields.  
   {#add-script-ai-agent__table_hg4_cbv_cdc__entry__2}

   | Fields | Description |
   |-|-|
   | Name | Name that you want to specify for your script. |
   | Description | Description of the script and what it's going to do to assist your AI agent. Note: This description is sent to the large language model (LLM). |
   | Script inputs | Input name and description to use in the script. The LLM uses the name and description to determine what value should be used at runtime. Example: Input name is task_record_sys_id and description is sys_id of the Task Record, this is mandatory. |
   | Script | JavaScript code that includes an object class or a function for your script. Note: For improved security, use GlideRecordSecure instead of GlideRecord and addUserEncodedQuery() instead of addEncodedQuery(). |
   | Execution mode | Mode of execution for your script: * Supervised: Inputs from your live agent are required during the execution of this tool while the AI agent runs. * Autonomous: Doesn't require any input from your live agent during the execution of this tool while the AI agent runs. {#add-script-ai-agent__ul_hfz_ccv_cdc} |
   | Display output | Permission to display the output of the tool execution in the Now Assist panel or in Virtual Agent: * Yes * No {#add-script-ai-agent__ul_ymf_fcv_cdc} |
   | Processing message | Message to display to users when the tool is running. |
   | Output transformation strategy | Style for the LLM to present the results. * None * Concise * Paragraph * Verbose |
   [Table 1. Add a script form]

   {#add-script-ai-agent__table_hg4_cbv_cdc}
5. Select Add.  
   A script tool is added in the Scripts section on the Add tools and information page.

*[\>]: and then


