Click + Add AI Action and select Create from Code.
The code editor opens with a blank function ready to edit.
Step 3: Write your function and define inputs
Write or paste the function you want the action to execute. As you build it:
Define your input parameters. These are the values the AI Agent will pass to your function at runtime. Declare them explicitly so the agent knows what to collect from the user before invoking the action.
Use a try...catch block. This ensures the action fails gracefully if the function or an external dependency returns an error.
Return the data explicitly. The AI Agent uses your function's return value to generate its response. If the function returns nothing, the agent has nothing to work with.
π‘ Tip: You can use libraries like Axios for HTTP requests. See [supported libraries] for the full list of available packages.
Step 4: Test your function in the editor
Run your function directly in the editor before moving to configuration. Supply a sample input value for each parameter and execute the function. Confirm it returns the output you expect.
If the result looks correct, proceed to the next step.
Step 5: Configure the action details
Click Next and fill in the following fields:
AI Action Name: Enter a short label. This name appears in the AI Actions list for this agent.
Description: Describe what the function does and when the agent should invoke it. Keep this specific the agent reads this field to decide when to call the action. A vague description can cause the agent to invoke the action at the wrong time or miss it entirely.
Output Description: Describe what a successful response looks like and what data it contains.
Approval Required: When enabled, the agent asks the user to confirm before executing the action. Disable this for read-only lookups. For actions that write or modify data, keep it enabled.
Question Variations: Enter example phrasings a user might say to trigger this action. Add several variations that reflect how your users actually phrase requests this improves how reliably the agent invokes the action.
Step 6: Publish the action
Review all fields, then click Publish AI Action. Confirm by clicking Publish Actions.
The action now appears in the AI Actions list for this agent.
Step 7: Test the published action
Open a conversation with your AI Agent and submit a request that should trigger the action. If Approval Required is enabled, the agent will ask for confirmation before executing. Once approved, the agent returns the action's output.
Step 8: Edit or disable the action
From the AI Actions tab, click the action to open its configuration. You can update the function code, input parameters, description, approval setting, or question variations at any time.
To prevent the agent from invoking the action automatically while keeping it in the list, disable Allow Direct Use from the action settings.
To remove the action entirely, click Delete.
π‘ Tip: If the agent is not invoking the action when expected, review the Description field and add question variations that match how your users actually phrase requests. See [AI Actions Troubleshooting] for more guidance.
What's next
AI Actions are invoked by the AI Agent directly or as steps within an AI Flow. To chain this action with other actions and logic branches, see [Configure AI Flows].
[Configuring AI Actions Using Pre-Built Templates] β connect platforms without writing code.