Import tools from an OpenAPI

Tools can be added to your agent from an OpenAPI specification. You can upload your OpenAPI specification and select the operations that you want to import as tools. Each operation is created as a separate tool.

Adding tools

First, decide whether to create a your OpenAPI tools directly in the system or for a specific agent:

To create an OpenAPI tool in the system:
  1. From the menu Menu, navigate to Build.

    For IBM Cloud environment, select the workspace where you want to create the tool from the workspace list, or create a new workspace.
  2. Select All tools.

  3. Select an existing tool or click Create tool+ to add a new tool.

  4. Select OpenAPI.

To create an OpenAPI tool within an agent:

  1. From the menu Menu, navigate to Build.

    For IBM Cloud environment, select the workspace for the agent from the workspace list.

  2. Select All agents.

  3. Find and click your agent.

  4. From the agent's toolset in the Toolset section, click Add tool.

  5. Click OpenAPI.

Next, import tools from an OpenAPI specification, complete the following steps:

  1. From the agent's toolset in the Toolset section, click Add tool.

  2. From the Add a tool menu, select the OpenAPI option.

  3. Drag and drop your OpenAPI file to upload. After the file is uploaded, click Next.

  4. Select the operations that you want to create as tools, then click Next.

  5. Do one of the following to associate connections with the OpenAPI specification:

    • Choose an available connection.

    • Click Add new connection to create a new one. You must provide the connection details to configure the connection in the Add new connection window.

  6. Click Done.
Tip:

You can now modify the configuration of an imported tool to connect it to a different connection. This flexibility allows you to respond to changes in authentication or environment without having to recreate the tool. For more information, see Overview of authentication types.

What to do next

After a tool is added, an agent can start using it. After adding your tools, consider the following:

  • Update the tool's description. The agent uses the tool description field to determine whether it will use the tool and how it will use the tool. Make sure to provide a detailed description for how the agent can use the tool. To update the tool description, click the tool menu and select Edit details. When you are satisfied with your description, click Save. You can continue to iterate on the description, as you test the tool.

  • Test the tool. To test your tool, use the prompt in the Preview chat window to invoke your tool.

  • Make sure the value that is returned from a Python tool matches the data type that you defined for that tool.