Skip to main content
OpenAPI tools provide a quick way to consume remote web services that include an OpenAPI specification file. For watsonx Orchestrate to use an OpenAPI tool, the following conditions must be met:
  • Endpoints must accept and return JSON.
  • The specification must include a servers block with exactly one URL. This URL cannot contain parameterization.
  • Each path that exposes an endpoint must include an operationId. This value becomes the tool name. For best results, use snake_case for operationId values.
  • Each path that exposes an endpoint must include a description. The agent uses this description to decide when to use the tool and what the tool does.
  • The OpenAPI version must be 3.0.
Here is an example of a minimal OpenAPI specification:
YAML

Importing OpenAPI based tools

To import an OpenAPI tool, run:
BASH

Additional features of OpenAPI tools

OpenAPI tools are fully compatible with the watsonx Orchestrate Connections framework. A connection represents a dependency on an external service and provides a way to associate credentials with a tool. Supported authentication methods include Basic, Bearer, API Key, OAuth, and IDP SSO flows.Connections are referenced using an application ID (app_id), which serves as the unique identifier for a connection. Each OpenAPI tool can be associated with only one connection app_id.For more information, see Connections.
OpenAPI tools are one of the two tool types that support asynchronous operations. These tools perform an action and then poll a status endpoint until the long-running process completes. Unlike synchronous tools, asynchronous tools can exceed the 40-second execution timeout in the UI.To create an asynchronous OpenAPI tool, your OpenAPI specification must include a callbackUrl header parameter as defined in the OpenAPI Callback Specification.
  • Use callbackUrl exactly as the header parameter name; other names are not supported.
  • The only supported content type for the callback response is application/json.
YAML
Callback Tool TypesFlow callbacks support four tool types: OpenAPI, Python, Flow, and MCP. The Flow runtime executes these callbacks using a fire-and-forget pattern for optimal performance.
RecommendationFor Flow callbacks, use OpenAPI tools as the preferred callback mechanism. OpenAPI tools provide a clean, stateless callback interface without the complexity of managing user interactions or correlation ID propagation.
Limitation: Flow Tools as CallbacksWhen using a Flow as a callback tool, there is a current limitation:
  • Restriction: Flow callback tools must not contain user activity nodes (nodes that require user interaction or input).
  • Reason: If a Flow callback contains user activity nodes, the Flow runtime would need to submit user activity events to the user’s chat thread. This requires propagating correlation IDs through the Flow callback event chain, which adds significant complexity to the implementation.
  • Workaround: To keep the implementation simple and maintainable, Flows used as callback tools should be designed without user interaction requirements.
Known Limitation: Custom context variables with v1 APIsWhen an asynchronous OpenAPI tool is invoked through the v1 /runs or /chat/completions API, custom context variables supplied in the request payload might not be available after the asynchronous operation completes. This can affect agent behavior that depends on those context variables, such as authorization plugins or request-validation logic.To work around this limitation on v1 APIs, use system context variables instead of custom variables. Preservation of custom context variables across asynchronous OpenAPI tool execution is supported on the v2 /chat/completions API.
By default, the tool runtime returns the response body of an OpenAPI operation to the agent as-is. If your API returns orchestration metadata or targets its response at a specific audience, add one or both of the following extensions to the operation in your OpenAPI specification. The ADK reads the extensions when you import the tool.Each extension accepts the following properties:
boolean
When true, the tool runtime reads the value from a response header. For x-ibm-orchestrate-meta, the header is X-IBM-Orchestrate-Meta. For x-ibm-orchestrate-audience, the header is X-IBM-Orchestrate-Audience.
string
The path to the key in the response body that contains the value, for example $._meta.
The following example reads the metadata from the _meta key and the audience from the audience key of the response body:
YAML
The two extensions are independent. Set the properties for each extension under its own key. If you don’t add an extension to an operation, the tool runtime doesn’t look for that value in the response.

Limitations and considerations

Using OpenAPI tools with your agents is straightforward, but default OpenAPI specifications often perform poorly as agent tools for the following reasons. If any of these issues apply to your use case, consider adjusting your OpenAPI specification or using Python tools instead.
  1. OpenAPI endpoints are designed for developers, not agents.
    • Developers can rely on context from other endpoints and external documentation to understand an endpoint’s purpose. Agents cannot. All necessary context must be included within the endpoint itself.
    • OpenAPI endpoints often include large sets of input arguments. In contrast, tools should have focused inputs and outputs that resolve a single task. For more information, see Designing agents and tools for best performance .
  2. Agents require a highly descriptive semantic layer.
  3. OpenAPI tools do not support x-ibm- extensions used in older watsonx Orchestrate Skills. The exceptions are x-ibm-orchestrate-meta and x-ibm-orchestrate-audience. For more information, see Returning metadata and audience from the API response.