Custom Tools
Organizations often create internal tools that would be useful in debugging or resolving incidents. Aptible AI can use these tools through our custom tools integration, which allows you to expose REST endpoints that Aptible AI can call to provide data or take action within your infrastructure.
Creating Custom Tools
The general process for providing a custom tool server is listed below. For code samples, OpenAPI spec, code generation, and more detailed information, see the Tool Server OpenAPI Spec.
Creating a Custom Tool Server
The only requirements for a custom tool server are that it exposes a REST API with the 2 endpoints detailed below, and that it be available on the public internet. Aptible AI will pass a bearer token for authentication.
Providing a List of Available Tools to Aptible AI
Your tool server should provide a list of possible tools available for Aptible AI to use. The response should be a JSON array with an object for each tool, in the following format:
Making a Custom Tool Callable
When Aptible AI wants to use a tool, it will make a POST
request to this endpoint
with a JSON object containing the input data. The
JSON input will be in whatever format you described in the tool’s description
field in the /tools
endpoint.
The response should be an arbitrary JSON result from the tool, which Aptible AI will parse and use as a potential response to the user.
Calling a Custom Tool
Providing a detailed description
of your tool in the /tools
endpoint is
important, as Aptible AI will use this information to decide if and when to
call your tool, based on the question it was asked.
For example, at Aptible, we have defined a tool that
tells us which Docker containers are running on a given host. To call that tool,
we ask @aptiblebot
a question like “What containers are running on host X?”.
Aptible AI calls our tool server with the input hostname, and returns the result back to the user in Slack:
Custom tools are also able to be called directly by using a slash command.
Authentication, OpenAPI Spec, and Code Examples
For more detailed information, including how to automatically generate a tool server in the language of tyour choice, see the Tool Server OpenAPI Spec repo on GitHub.