
Creating Integrations Using Agentforce
The Agentforce generative flow feature in Anypoint Code Builder transforms your natural language input, which describes your business logic, into a flow that contains the connector operations and processors, in the correct order, to accomplish the specified task.
For example, if you want to create a flow that reads contacts from Salesforce in JSON format, enter a message describing that task. The message is then transformed into a series of the connector operations and processors needed to execute that task, in this case: Listener, Query, Transformer, and Logger.
Agentforce generates a flow, which you can then further configure to suit your specific needs.
Before You Begin
Before you start creating your integration:
-
Ensure that you have the required Anypoint Code Builder permissions.
-
Ensure that you have these permissions to use the Anypoint Code Builder Agentforce feature:
-
Anypoint Code Builder Developer
-
Mule Developer Generative AI User
-
-
Einstein must be enabled in Access Management. For more information, see Enabling Einstein for Anypoint Platform.
Access Agentforce
There are two ways to open Agentforce:
-
When you create a new integration project, click a card in the flow canvas. For example, the Build a Flow with Agentforce card.
-
Click the Agentforce icon in the toolbar.
Create a New Integration Project
To create a new integration development project:
-
In the activity bar of the IDE, click the
(Anypoint Code Builder) icon.
-
From Quick Actions, click Develop an Integration:
-
Complete the Develop an Integration form:
Field Name Field Value Project Name
Unique name for your project.
This name is used as the title and name of the integration specification file. For example, if the project name is "My Integration", the name of the folder for the integration project is
my-integration
, and the configuration XML file name ismy-integration.xml
.Project Location
Your home directory or another directory you create. Click Browse to select a directory for the integration if you don’t want to use the prepopulated location.
-
Click Create Project.
The flow builder canvas appears with starting cards.
To use Agentforce to generate a flow, click Use Agentforce in the Build a Flow with Agentforce card. To use connectors to easily embed an agent or use an LLM from within your MuleSoft applications, click Connect to an agent or Connect to an LLM in the Build Agentforce Integrations card. To build your flow from scratch, click Build a flow in the Start From Scratch card.
Craft Your Input
Before you create a flow, define what you want to achieve with the flow, for example, optimizing a business process. In the Agentforce pane, click New Chat and craft your message using natural language. Keep in mind that the more concise and specific you make your message, the more effective Agentforce is when generating your flow.
These are some best practices for writing messages:
-
Be clear and precise.
Use clear and specific language to describe the use case for the flow to build.
-
Include triggering events.
Mention the triggering events that initiate the flow, for example, sending an email when a new case is created.
-
Emphasize key components.
Highlight the key MuleSoft components and connector operations to include in the flow, for example, HTTP Connector Listener and Email Connector Send operations.
-
Specify the data objects.
Clearly mention the data objects to include in the flow, such as "Salesforce Account object" or any other relevant data source.
-
Proofread your message.
Review your message to ensure that it’s clear and comprehensive before you send it.
After Agentforce generates the initial flow, you can then customize the code for your specific needs. Or, you can continue the conversation to have Agentforce revise the flow after each message you send.
For examples of messages and generated flows, see Generative Flow Examples.
|
View Your Chat History
The message history for a project shows the previous 50 messages for that project. The history can be helpful for reference during the development process.
To see the chat history:
-
Click the open chat history icon.
You see a list of your previous messages, up to the maximum of 50. You can rename your chats in chat history.
-
Click a message in the list to see the details of the generated flow.
You can insert the code that was generated into your flow, or you can copy the code snippet and use or modify it elsewhere.
Add a Flow to Your Project
Add a flow to your integration project using Agentforce:
-
In the Build a Flow with Agentforce card, click Use Agentforce.
Optionally, click an example on the Build a Flow with Agentforce card to see how this feature works.
-
If this is the first time you’re using this feature, agree to the terms, and continue.
The Agentforce panel opens:
-
Enter a message to create the initial flow for your task.
Optionally, click an example to get started.
When your flow is ready, the code and a description of the components in the flow appear in the Agentforce panel:
-
Optionally, click the thumbs up or thumbs down icon that appears after the generated code.
Rating the flow that’s created for you helps improve the quality of generative flows.
-
Inspect the generated code. If you’re satisfied, click the insert code icon to add the code to your flow.
If you aren’t satisfied with the generated flow, try rewording your message and sending it again.
Complete Your Flow
After Agentforce builds the flow, fill in information specific to your configuration as needed.
-
After you inspect the code for your generated flow, you can either copy it into your clipboard or insert it with a single click using the Insert action.
After you insert the code, the initial flow is built and the visual representation of the flow is shown in the flow canvas next to the XML code tab.
Components that require further configuration display the error icon.
-
Select the component in the canvas to determine where the error is.
Anypoint Code Builder highlights the location of the error within the configuration XML.