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 as you can see the following openapi schema is valid { "openapi" "3 0 0", "info" { "title" "agenthost gpt api", "version" "1 0 0", "description" "api for determining how many messages a user can send and upgrading to plans to get more access" }, "servers" \[ { "url" "https //api stage agenthost ai" } ], "paths" { "/api/openai/log in/" { "post" { "summary" "logs in the user by sending them a code to their email", "operationid" "login", "x openai isconsequential"\ false, "description" "logs the user into their account by first sending a code to their email which they will then call this endpoint with", "requestbody" { "required"\ true, "content" { "application/json" { "schema" { "type" "object", "properties" { "email" { "type" "string", "description" "the user's email" }, "code" { "type" "string", "description" "code sent to users email" } } } } } }, "responses" { "200" { "description" "successful response", "content" { "application/json" { "schema" { "type" "object", "properties" { "success" { "type" "integer" }, "message" { "type" "string" } } } } } }, "400" { "description" "bad request" }, "500" { "description" "internal server error" } } } }, "/api/openai/user message limit/" { "post" { "summary" "gets the number of messages the user can send", "operationid" "getusermessagelimit", "x openai isconsequential"\ false, "description" "gets the number of messages that the user can send (references content)", "requestbody" { "required"\ false, "content" { "application/json" { "schema" { "type" "object", "properties" { "email" { "type" "string", "description" "the user's email" } } } } } }, "responses" { "200" { "description" "successful response", "content" { "application/json" { "schema" { "type" "object", "properties" { "limit" { "type" "integer" } } } } } }, "400" { "description" "bad request" }, "500" { "description" "internal server error" } } } }, "/api/openai/available plans" { "get" { "summary" "get's all the available plans", "operationid" "getavailableplans", "x openai isconsequential"\ false, "description" "gets the plans that are available to the user", "responses" { "200" { "description" "successful response", "content" { "application/json" { "schema" { "type" "object", "properties" { "plans" { "type" "array", "items" { "type" "object", "properties" { "title" { "type" "string" }, "price" { "type" "integer" }, "interval" { "type" "string" }, "signup link" { "type" "string" } } } } } } } } }, "400" { "description" "bad request" }, "500" { "description" "internal server error" } } } } }, "components" { "schemas" { }, "securityschemes" { "bearerauth" { "type" "http", "scheme" "bearer", "bearerformat" "jwt", "description" "jwt to authorize requests" } } } } creating your custom action to create your custom action, do the following go to the workspace and select the agent you would like to add a custom action to select custom domains from the sidebar click the create action button to add a new custom action enter a title for your custom action this is just for your reference copy and paste your valid openapi schema enter any needed credentials and select a credential type 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 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