AI Agent Engineering > Build an AI agent > Tool blocks
  

Tool blocks

You can run a tool like a Serper Search or REST API tool in an agent flow. To do this, add a tool block to the flow and select the connection to the tool you want to run. Then configure the input and output parameters.
To add a tool block to an agent flow, drag and drop a Tool Block from the Activities menu into the flow. The AI agent excutes the tool in the order in which it appears in the agent flow. So, if you add a tool block in an agent flow before an agent block, the tool runs before the AI agent starts its task.
Tip: If you want the agent to decide whether and how often to execute the tool, add the tool to the agent block instead.
When you configure a tool block, you choose the tool connection. You can't create a tool connection in a tool block. For information about creating a tool connection, see Tool connections.
A tool block contains input and output parameters that represent the values that you pass into and receive from the tool. You set the value of each input and output parameter to an agent flow variable.
The following image shows a tool block in an agent flow:
The tool block shows a Salesforce tool connection named "QueryOrders_SF." The input and output parameters are expanded and their values are set to agent flow variables.

Example: Use a Salesforce tool to query order information

Your agent flow needs to query order information that's stored in Salesforce. You've already configured a Salesforce tool connection named QueryOrders_SF to connect to Salesforce and retrieve the information.
Perform the following steps:
  1. 1Drag and drop a tool block into the agent flow.
  2. 2In the tool block, select the tool connection QueryOrders_SF.
  3. 3Expand the input and output parameters.
  4. You see that the tool contains the input parameter query and the output parameter response.
  5. 4In the agent flow, create the following variables to store the query and response:
  6. Variable name
    Data type
    queryToSF
    string
    responseFromSF
    string
  7. 5In the tool block, configure the following values for the input and output parameters:
  8. Type
    Name
    Value
    Input parameter
    query
    queryToSF
    Output parameter
    response
    responseFromSF