{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":22653,"path":"intelligent-experiences/add-trigger-aia-new.md","title":"Add a trigger to an AI agent","bundle":null,"doc_type":null,"release":"australia","body":"\n# Add a trigger to an AI agent\n\nIn the guided setup for an AI agent, add triggers to run the AI agent automatically when certain conditions are met.\n\n## Before you begin\n\nRole required: sn\\_aia.admin\n\n## About this task\n\nAdding a trigger is optional. If you want your AI agent to be used only in chats, you don't need to add a trigger. Only add a trigger if you want to invoke the AI agent automatically when some event occurs. Triggers can be added, edited, and removed at any time, and an agent with no trigger can still be used in chat.\n\nA trigger determines how often and how widely the agent runs, so scope the condition before activating it. A condition that matches a large set of records invokes the agent for each of them, and a scheduled trigger processes a capped number of records per run, ten by default. [Test the agent manually](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/intelligent-experiences/test-ai-asset-new.md) against a single record that meets the condition first.\n\nIf you don't want to add a trigger, skip to the next step, [Select channels and messages](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/intelligent-experiences/channels-access-aia-new.md).\n\n## Procedure\n\n1.  Select a trigger type from the dropdown.\n\n    The trigger type determines when the AI agent will be invoked.\n\n2.  Enter details for the trigger.\n\n    1.  Enter a name for the trigger.\n\n    2.  Select the table on which the trigger will run.\n\n    3.  Define the conditions that must be met for the trigger to activate.\n\n        You must define at least one condition to create a trigger.\n\n    4.  Enter the objective for the AI agent in the **Objective for this AI agent** field.\n\n3.  Define user identity and data access for the trigger.\n\n    1.  Choose how to define the user identity for this trigger.\n\n        You can use an AI user identity, an existing table, or a new custom script. The user identity determines what data the AI agent can access when the trigger runs.\n\n    2.  Select the AI user identity.\n\n        **Note:** This trigger runs as a type of user identity with roles and associated data access rules it can impose on the AI agent. Review the AI agent's access rules to prevent any rule conflicts or gaps.\n\n4.  Configure the trigger channel.\n\n    1.  Select where the AI agent will launch.\n\n        You can choose to launch the AI agent in the ServiceNow Otto panel or Virtual Agent.\n\n    2.  Choose whether to show an alert to users by toggling **Show an alert to users**.\n\n5.  Select **Save**.\n\n    If you choose a scheduled trigger, additional options are available, such as the day of the week and time when you want the trigger to run.\n\n    **Note:** When running a scheduled trigger, not every record is included in the execution. By default, the value is 10. If you want to change this number, you must set the **sn\\_aia.max\\_scheduled\\_trigger\\_query** system property to a different value.\n\n    If you choose an email trigger, the target emails must exist on the Reply \\[sys\\_reply\\] table. New emails aren’t available as triggers.\n\n6.  Repeat the preceding steps for additional triggers.\n\n\n## Result\n\nYou have added triggers to your AI agent to run it automatically under the specified conditions.\n\n## What to do next\n\nScroll down to the next section of the guided setup, **Channel and display**, to [configure where the AI agent can be invoked and set processing messages](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/intelligent-experiences/channels-access-aia-new.md).\n\n"}}