How to use Platform API tools
Overview#
This page describes how to use any of the Platform API tools. These tools wrap platform API read calls so that AI agents can use them.
Currently, the following tools are available:
- IafItemSvc
- IafPassSvc
- IafFileSvc
Main steps#
To use any of the the Platform API tools, do the following steps:
- List the available tools
- Create an agent
- Create a team
- Initiate conversation with the team
- Continue the conversation
Refer to the sections below for a description of each step.
Step 1: List the available tools#
To list all available Platform API tools, use the API call IafAISvc.getTools.
This API call retrieves all tools available to the current user based on their permissions.
For more information, refer to the AI Service Rest API Tools page.
Note: By default, system tools are available to all users.
Step 2: Create an agent#
To create an agent use the API call IafAISvc.createAgents.
In the call, you must specify the tools you want it to use. You may assign one or multiple tools depending on your use case.
For more information, refer to the AI Service Rest API Agents page.
Refer to the JSON code below as an example.
[ { "_name": "Item Service Agent", "_background": "It interacts with Item service tools and get either named user items or related items. The criteria would follow the mongo syntaxes", "_userType": "Item_Service_Agent", "_namespaces": [ "build30_awei1849" ], "_config": { "model": "gpt-4o", "provider": "openai" }, "_tools": [ "GetNamedUserItemsTool", "GetRelatedItemsTool" ] }]
Step 3: Create a team#
To create a team that makes use of the agent defined in the previous step, use the API call IafAISvc.createTeam.
Creating the team also defines the flow path that determines how agents process the request.
For more information, refer to the AI Service Rest API Teams page.
Refer to the example code below.
{ "_name": "Item service Team", "_namespaces":["build30_awei1849"], "_agents": [ { "_userType": "Item_Service_Agent" } ], "_flow": [ { "from": "__start__", "to": "Item_Service_Agent" }, { "from": "Item_Service_Agent", "to": "__end__" } ]}Step 4: Initiate conversation with the team#
To start a new conversation with teah, use the API call IafAISvc.createConversation. Ensure that you provide both the input message and the team ID.
For more information, refer to the AI Service Rest API Conversations page.
Refer to the sample code below.
{ "_input": { "message": "Identify the system component collection and retrieve all the Related items from it" }, "_teamId": "8758fecb-82ee-49d2-a996-ce79eafcf67d"}Step 5: Continue the conversation#
To continue an existing conversation, reference the conversation ID from the previous response.
Refer to the sample code below.
{ "_id": "f8080591-000e-42a3-8a41-7a23d885cad5", "_input": { "message": "How many Hvac system components in the system components collection" }, "_teamId": "d31e87ea-be3b-4501-91b1-aab79f5f9229"}