Guides

Custom actions

6min

Introduction

Custom actions allow your agents to utilize external services via API calls. Agenthost supports using custom actions with the ability to call essentially any external api. In order to do so, you will need to create a valid OpenAPI schema for your action.

Compatability with OpenAI action schema

The OpenAI action schema is less strict than Agenthost's action schema. This means that Agenthost's schema wil always work on OpenAI but OpenAI's schema may not work in Agenthost.

Guide on creation OpenAPI Schema

In order to create an action on Agenthost, you'll need to create an OpenAPI schema. If you do not know how to create an OpenAPI schema for the API's you would like your agent to connect to, we highly recommend following this guide by OpenAI.

Schema validation

Once you have the first draft of your OpenAPI schema, you should validate that your schema is correct. We recommend using this validator to confirm your schema is valid.

Go to Validate Text then copy and paste your OpenAPI schema in the text box.

You should see a response like this.

Document image


As you can see the following OpenAPI schema is valid.

JSON




Creating your custom action

To create your custom action, do the following.

  1. Go to the workspace and select the agent you would like to add a custom action to.
  2. Select Custom Domains from the sidebar.
  3. Click the Create Action button to add a new custom action.
  4. Enter a title for your custom action. This is just for your reference.
  5. Copy and paste your valid OpenAPI schema.
  6. Enter any needed credentials and select a credential type.
  7. Be sure to update your instructions to tell your agent to use the new operations and actions based on their name. You can view the detected operations under Operations
Document image


Credentials

Now that you have a valid OpenAPI schema pasted in the custom action, you should add any authentication tokens that are needed to authenticate the request. Agenthost will securly encrypt and store the credentials when used by your agent.