API Tool in AI Agent

Updated 

The API Tool allows an AI Agent to interact with external systems by making API calls. You can configure this tool to send inputs, receive outputs, and handle errors during execution.

Steps to Configure API Tool

Follow the steps below to configure the Update Properties Tool in AI Agent Studio:

1. Access the API Tool

  • Navigate to AI Agent Studio from the Sprinklr Launchpad.

  • Select the AI Agent you want to configure.

  • Expand the Build section and open Tools.

  • Click + Add Tool and select API Tool from the list.

2. Configure Overview

  • Name: Enter a descriptive name for the API Tool. This helps identify the tool when configuring or troubleshooting.

  • Description: Provide a brief description of the tool’s purpose or functionality. For example: “Fetch customer details from CRM.”

3. Configure Setup Function

This section includes additional settings required to configure your API function. It ensures proper integration with the selected API.

  • API Type: Choose the type of API you want to use:

  • Parsed API – For REST APIs or APIs returning structured JSON responses.

  • SOAP API – For APIs using SOAP protocol.

  • API: Select the API that is already configured in your Sprinklr environment.

    If the API is not yet configured, click the + API button to set it up inline. You will be redirected to the Extensions Library where you can configure external API from available templates or create a custom integration from scratch.

  • API Endpoint: Choose the specific endpoint within the selected API that the AI Agent will call.

4. Configure Setup Input

Configure the input settings for the selected API. These define what data is sent in the API request.

Input Variables

Define variables that will hold the values sent to the API.

  • API Input: Specify the input to send to the API for each input parameter.

  • Select Value: Choose the source of the input value

Inputs from LLM

The AI Agent extracts the value dynamically from the conversation context using the language model.

  • API Input: Specify the input that AI Agent extracts from the conversation.

  • Mandatory: Indicate whether the input parameter is required:

  • Yes: The API call will fail if this input is missing.

  • No: The API call can proceed without this input.

5. Configure Setup Output

Configure how the API response is handled and mapped for use by the AI Agent.

  • Output Variable: Enter the variable name that will store the API response.

  • Error Variable: Define a variable to capture error messages or codes if the API call fails.

  • Adapt response before sending (Toggle): Enable this option if you want to transform or adapt the API response before using it in the conversation.

    • Adapt Response: Write Groovy code to parse, update, or format API responses and store the result in an Adapted Response Variable for later use. The modified output is what gets published. Groovy code should be written inside ${}.

    • Adapted Result Variable: Enter the variable name that will store the adapted response.

Click the Save button in the bottom right corner to add the API tool to your AI Agent.

The API Tool makes it easy for your AI Agent to connect with other applications and share information. With this feature, you can:

  • Get real-time data from systems like CRM or ERP so your team always has the latest information.

  • Update order details or customer records during a conversation, saving time and reducing manual work.

  • Check inputs before moving forward to make sure the information is correct and avoid mistakes.

These capabilities help simplify processes, improve customer service, and make everyday tasks faster and more accurate.