Invoke an AI Agent from an Integration

You can start an AI agent from an integration and incorporate AI agents into existing integrations. The prerequisite is that the AI agent must be in an Active state.

Examples of what you can do

  • You have a scheduled integration. Every Monday morning, you schedule an AI agent to process documents.
  • You have an AI agent that processes new opportunities when new opportunities are created in Salesforce. You create an integration that registers for a Salesforce business event. You run the AI agent whenever a business event comes in.
  • You have an integration based on File Server system events. Whenever a file arrives in File Server, the system event initiates the integration, which starts an AI agent to process the file.
  • You use an integration to orchestrate multiple AI agents by calling several agents from within the same integration.

Invoke an AI agent from an integration

  1. Add an AI Agent action to an integration in either of the following ways:
    • On the side of the canvas, click Actions Integration actions icon and drag to the appropriate location.
    • Click Add icon at the location where you want to add the action, type AI, then select AI Agent.
  2. Configure the AI agent details.
    1. In Configure Basic Info, configure fields for your AI agent:
      • What do you want to call your endpoint: Required. Enter a meaningful name that reflects the business function of the AI agent such as CallApproveExpenseAgent.
      • What does this endpoint do: Optional description for the AI agent to invoke. For example: This AI agent approves office expenses.
    2. In Configuration, select the current project or any shared project in which your AI agent resides, and the AI agent that you want to invoke, and click Continue. Only agents with the Active status are displayed for selection.
    3. Click Finish to complete configuring the AI agent in your integration.
      A map is automatically created.
  3. Configure mapping for your AI agent.
    1. Configure parameters and values to run your AI agent.
      Parameters:
      • Project Id: Optional. Use to specify a different project than selected in the configuration wizard. You can view a project's identifier in the project details page when you edit the project details. See Edit Project Description Details.
      • Agent Id: Optional. Use to specify a different AI agent than selected in the configuration wizard. You can view the AI agent identifier in the AI agent details page when you edit the AI agent.
      • Conversation Id: Optional. When an AI agent runs, a conversation ID is automatically generated by default, unless you specify the conversation ID. Specify a conversation ID when sending data back to an AI agent or when you want the AI agent to have knowledge of prompts, data, and decisions made in other runs. The conversation ID can span multiple instance IDs. You can view the conversation ID when you run an AI agent. See Get the conversation ID.

      Body:

      Values you specify here are used to run the AI agent. You specify either Prompt or Prompt Template Id and Payload.

      Specify a prompt:

      • Prompt: Specify the prompt to send to the AI agent.

      If you have a prompt template, specify the Prompt Template Id and Payload:

      • Prompt Template Id: Prompt template identifier. If you created prompt templates for the AI agent, you can specify the prompt template to use. Format: ID | version. For example:
         "promptTemplateId": "USER_PROMPT_TEMPLATE|01.00.0000"
      • Payload: Payload must be stringified JSON. For example:
        "payload": "{\"user\":\"User1 User1LastName\"}"
    2. When mapping is complete, click Validate.
    3. Click Back Back icon to return to the Integration canvas.
    4. Click Save.
  4. Activate the integration.
  5. Run the integration and specify the request. The integration runs the AI agent.
    Here are some example prompts with sample values.

    Example: sending a prompt to the integration

    { "userprompt": "Hi, my name is User1 User1LastName" }

    Example: using a prompt template with payload and conversation ID

    {
      "promptTemplateId": "USER_PROMPT_TEMPLATE|01.00.0000",
      "conversationId": "abc12345x61023",
      "payload": "{\"user\":\"User1 User1LastName\"}"
    }