watsonx Orchestrate

 View Only

Discover and invoke watsonx Orchestrate skills via API

By Kam To Frederick Ngo posted 6 days ago

  

Your company has some very useful Generative AI, Decision and Workflow skills in IBM watsonx Orchestrate. People in the organization are using those skills with the IBM watsonx Orchestrate chat. Now your team is tagged to create an application that needs to leverage and use those skills. Your application, however, cannot interact with the IBM watsonx Orchestrate chat like a person. What can you do?

The new watsonx Orchestrate API, especially the skillsets and skills API, comes in handy in this case. Workflow, Decision, Generative AI, and imported skills belong to a skillset, e.g., personal, team, and assistant, can be discovered and invoked via REST APIs. The APIs are easy to use. Here is an example of how to use the APIs:

  1. You will need to know the API endpoint of your IBM watsonx Orchestrate tenant. You can follow the steps in https://www.ibm.com/docs/en/watsonx/watson-orchestrate/current?topic=api-getting-endpoint to obtain the API endpoint.
  2. The watsonx Orchestrate API currently only supports bearer token authorization. You will need to obtain an API key of the user account that you like to use to invoke the API, then use a provided REST API to exchange the JWT token. Keep in mind that the API key is long-lived (in terms of months) while the exchanged token is short-lived (in term of minutes). I would suggest to reuse the same API key until it expires as there could be limit imposed on a number of generated API keys on an user account. You can follow the steps in https://www.ibm.com/docs/en/watsonx/watson-orchestrate/current?topic=api-generating-key to obtain the API key and the API in https://developer.ibm.com/apis/catalog/watsonorchestrate--custom-assistants/api/API--watsonorchestrate--authenticating-to-watsonx-orchestrate-api#generatingjwttoken to exchange the JWT token.
  3. Use the {api_endpoint}/v1/skillsets API to discover the available skillsets. This API returns you all available skillsets for the user account. In the response, for each skillset, it has an URL for you to obtain the available skills of the skillset.
  4. Use the {api_endpoint}/v1/skillsets/{skillset_id} (obtained from the response from step 3 above) to discover the available skills of the skillset. In the response, for each skill, it has the openAPI url for you to obtain the skill openAPI spec. Note that only Workflow, Decision, Generative AI, and imported skills will be returned.
  5. Use the {api_endpoint}/v1/skillsets/{skillset_id}/skills/{skill_id}/openapi (obtained from the response from step 4 above) to download the skill openAPI spec. You can then construct the skill invocation request based on the spec, e.g., server.url, operation path, input param, etc.
  6. Invoke the skill based on the skill openAPI spec returned from step 5 above.

You can find the details about the above APIs and other available IBM watsonx Orchestrate APIs in https://www.ibm.com/docs/en/watsonx/watson-orchestrate/current?topic=watsonx-orchestrate-api. As of the writing of this blog, the APIs are in Beta release.

I appreciate any comments or feedback, using the comment function below.

0 comments
5 views

Permalink