Watsonx Orchestrate is IBM’s platform to run agentic systems. To make developers productive, Orchestrate can be run locally via the watsonx Orchestrate Developer Edition. This post describes how to invoke local agents from local applications via APIs.
Watsonx Orchestrate provides APIs. The OpenAPI documentation can be accessed via the localhost:4321/docs endpoint.
Bearer Token
All APIs require bearer tokens for authentication. For example, when running Orchestrate on IBM Cloud you can retrieve the tokens via curl and CLI.
When running Orchestrate locally as containers, you can read the token from a configuration file.
1
2
3
4
cat ~/.cache/orchestrate/credentials.yaml
auth:
local:
wxo_mcsp_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJz.....
Invocation
For the chat/completions API you also need the agent id.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
orchestrate agents list --verbose
curl --request POST \
--url http://localhost:4321/api/v1/orchestrate/agent-id/chat/completions \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJz.....' \
--header 'Content-Type: application/json' \
--data '{
"stream": true,
"messages": [
{
"role": "user",
"content": "Hi"
}
]
}'
There is also a nice Try it experience on the Developer Orchestrate site that helps putting together the curl commands, see the screenshot at the top of this post.
Next Steps
To find out more, check out the following resources: