This is a cache of https://developer.ibm.com/tutorials/create-maximo-agent-watsonx-orchestrate/. It is a snapshot of the page as it appeared on 2025-11-24T08:50:16.666+0000.
Automate Maximo workflows with watsonx Orchestrate ADK - IBM Developer
This Maximo agent works with IBM Maximo to perform the following tasks:
Fetch assets from Maximo Health based on a health score provided by the user.
Create service requests in Maximo when the user confirms the asset number.
This tutorial guides you through creating two Python tools, setting up connections, and linking them to the agent. Each tool uses Python and makes REST API calls to the Maximo instance. For authentication, we will create a connection that stores the API key of Maximo. This key will be used by the Python tools to authenticate and make the API calls.
A connection is used to store credentials for external services. Create a connection to save the Maximo API key, which the Python tools use for REST API calls.
To configure the connection, run the following commands in the terminal to set your API key. Replace api-key-value with the API key from your Maximo instance.
import requests
from ibm_watsonx_orchestrate.agent_builder.tools import tool, ToolPermission
from ibm_watsonx_orchestrate.run import connections
from ibm_watsonx_orchestrate.agent_builder.connections import ConnectionType, ExpectedCredentials
@tool(
name="healthapi",
permission=ToolPermission.READ_ONLY,
expected_credentials=[ExpectedCredentials(
app_id = "maximo_connection",
type = ConnectionType.API_KEY_AUTH
)],
description="This tool will fetch the assets whose assethealth is below the given threshold.")defhealth_api(assethealth: int):
"""
Fetches a list of assets from Maximo whose health is below the given threshold.
The function queries the Maximo Health API using the provided asset health value
and returns the JSON response containing key asset metrics like asset number, health score,
criticality, and risk trend.
Args:
assethealth (int): Integer threshold to filter assets with assethealth less than this value.
Returns:
str: JSON response as a string from the Maximo API.
"""
BASE_URL = "https://demo.manage.maximo.cloud/"
url = BASE_URL+ "maximo/api/os/mhasset?lean=1&oslc.select=assetuid,assetnum,assethealth, apm_scorecriticality.apmnumval, apm_scorerisk.scoretrendvalue&oslc.pageSize=5&oslc.where=assethealth<"+str(assethealth)
conn = connections.api_key_auth("maximo_connection")
headers = {
"apikey": conn.api_key
}
response = requests.get(url, headers=headers, verify=False)
if response.status_code != 200:
raise Exception(f"API request failed with status {response.status_code}: {response.text}")
return response.text
Copy codeCopied!Show more
servicerequest.py: Create a service request
import requests
import json
from ibm_watsonx_orchestrate.agent_builder.tools import tool, ToolPermission
from ibm_watsonx_orchestrate.run import connections
from ibm_watsonx_orchestrate.agent_builder.connections import ConnectionType, ExpectedCredentials
@tool(
name="servicerequest",
permission=ToolPermission.READ_ONLY,
expected_credentials=[ExpectedCredentials(
app_id = "maximo_connection",
type = ConnectionType.API_KEY_AUTH
)],
description="Creates service request for assetnum in the Maximo manage. assetnum, description and site fields are mandatory before creating a serivce request.")defhealth_api(assetnum: str, site: str, description: str):
"""
Creates a service request in the Maixmo Manage
Args:
assetnum (str): Name of assetnum for which service request to be created
site (str): Site name where the asset is located
description (str): Description of Service request
Returns:
str: JSON response as a string from the Maximo API.
"""
BASE_URL = "https://demo.manage.maximo.cloud/"
url = BASE_URL + "maximo/api/os/mxapisr/?lean=1"
request_body = {
"historyflag": False,
"sitevisit": True,
"actlabhrs": 0,
"status": "NEW",
"template": False,
"description": description,
"description_longdescription": "This SR is created for demo purpose",
"reportedby": "leap",
"site": site
}
conn = connections.api_key_auth("maximo_connection")
headers = {
"apikey": conn.api_key
}
response = requests.post(url, json=request_body, headers=headers, verify=False)
if response.status_code != 201:
raise Exception(f"API request failed with status {response.status_code}: {response.text}")
return"Service request created successfully"
Copy codeCopied!Show more
Note: Make sure to update the BASE_URL with the URL of your Maximo instance.
In both tool files (health.py and servicerequest.py), we used maximo_connection. This tells ADK to use the connection values. Run the following commands to import the tools:
Note: In the preceding commands, the value of --app-id is the connection name.
Step 3. Create an agent
Create a file named maximo.yaml and add the following code. For more details, see Authoring agents.
spec_version:v1kind:nativestyle:reactname:maximollm:watsonx/meta-llama/llama-3-2-90b-vision-instructdescription:>
You are a Maximo agent which performs task like fetching the assets based on the health, creates service request etc. Use the given tools to complete the tasks.
instructions:>
You have access to below tools to full fill the request.
*healthapi* tool to get the list of the assets which has assethealth lower than given value. Focus on the assetnum,assethealth fields in the reponse. Display the response in the clear TABLE format. After that suggest the assetnum for which service request should be created.
*servicerequest* tool to create a service request in the Maximo manage for given assetnum. If assetnum is not given, ask for the assetnum.
collaborators: []
tools:-healthapi-servicerequest
Copy codeCopied!
To import the agent, run the following command:
orchestrate agents import -f maximo.yaml
Copy codeCopied!
The maximo agent will now be available in watsonx Orchestrate and ready to use.
Example flow in watsonx Orchestrate
User: Show me assets with health less than 10
Agent uses health.py to fetch the list.
User: Create service request for asset
Agent uses servicerequest.py to create the request.
Conclusion and next steps
With a few Python files and basic setup, you have created a Maximo agent using watsonx Orchestrate ADK. This agent can:
Connect to Maximo with secure credentials
Fetch assets by health score
Create service requests
You can extend it to handle more workflows or add more Maximo tools.
About cookies on this siteOur websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising.For more information, please review your cookie preferences options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.