Agents
Create, manage and invoke conversation with agents.
Agents have three main components
-
Instruction - This is very important as it tells the agent what it is supposed to do. For example, you can tell the agent that it is a sales agent and it should help the user with their purchase.
-
Knowledge Base - Agents can be trained on a knowledge base. This is a collection of data that the agent can use to respond to queries.
-
Forms - If you want to collect structured information from the user, you can use forms.
Create an Agent
Creates an agent. You can simply create an agent with the type of agent you want to create and then update the agent with more details.
- Name
title
- Type
- string
- Required
- required
- Description
Give your agent a user friendly name. This information is not used for training the agent and is only for display purposes.
- Name
instructions
- Type
- string
- Required
- optional
- Description
This is the most important part of the agent. It tells the agent what it is supposed to do. For example, you can tell the agent that it is a sales agent and it should help the user with their purchase. Make it as specific as possible. Edit this later if you want to make changes and improve responses.
Default: "You are a helpful assistant."
- Name
description
- Type
- string
- Required
- optional
- Description
Give a short description of the agent. This information is not used for training the agent and is only for display purposes.
- Name
coverimage
- Type
- string
- Required
- optional
- Description
URL of the cover image for the agent. Recommended size is 512px x 512px.
- Name
intromessage
- Type
- string
- Required
- optional
- Description
This is the first message that the agent will send to the user. You can use this to greet the user and set the context for the conversation. In voice agents, this message is adapted to the first response received from the user.
- Name
knowledge_search
- Type
- boolean
- Required
- optional
- Description
Enable knowledge base search.
- Name
knowledge_id
- Type
- string
- Required
- optional
- Description
Knowledge Base ID to be used by the agent for answering queries.
Leave this blank if you want to create a new knowledge base.
Request
{
"title": "My First AI Agent",
"knowledge_search": true,
}
Response
{
"namespace": "myfirstaiagent_1733206677149149",
"type": "chat",
"coverimage": "https://www.burgersinghonline.com/wp-content/themes/burger-singh/front/images/logo-v=0.1.png",
"title": "My First AI Agent",
"description": "Ask me anything",
"intromessage": "How can I help you today?",
"instructions": "You are a helpful assistant. Answer the questions based on the information you are given. If answer is not available in the context, try to navigate the conversation smartly. Answer in English only.",
"knowledge_search": true,
"knowledge_id": "myfirstaiagent_1733206677149149"
}
Retrieve Agent
Return information about an agent.
Path parameters
- Name
namespace
- Type
- string
- Required
- required
- Description
The namespace of the agent.
Response
{
"namespace": "myfirstaiagent_1733206677149149",
"type": "chat",
"coverimage": "https://www.burgersinghonline.com/wp-content/themes/burger-singh/front/images/logo-v=0.1.png",
"title": "My First AI Agent",
"description": "Ask me anything",
"intromessage": "How can I help you today?",
"instructions": "You are a helpful assistant. Answer the questions based on the information you are given. If answer is not available in the context, try to navigate the conversation smartly. Answer in English only.",
"knowledge_search": true,
"knowledge_id": "myfirstaiagent_1733206677149149"
}
List Agents
List agents.
Response
{
"agents": [
{
"namespace": "myfirstaiagent_1733206677149149",
"type": "chat",
"coverimage": "https://www.burgersinghonline.com/wp-content/themes/burger-singh/front/images/logo-v=0.1.png",
"title": "My First AI Agent",
"description": "Ask me anything",
"intromessage": "How can I help you today?",
"instructions": "You are a helpful assistant. Answer the questions based on the information you are given. If answer is not available in the context, try to navigate the conversation smartly. Answer in English only.",
"knowledge_search": true,
"knowledge_id": "myfirstaiagent_1733206677149149"
},
///...
],
"meta": {
"total_items": 14
}
}
Update Agent
Updates an agent. You can specify only the properties you want to update.
Path parameters
- Name
namespace
- Type
- string
- Required
- required
- Description
The namespace of the agent.
Request body
- Name
title
- Type
- string
- Required
- optional
- Description
Give your agent a user friendly name. This information is not used for training the agent and is only for display purposes.
- Name
type
- Type
- integer
- Required
- optional
- Description
Specify the type of agent you want to create.
Options -
notebook
,chat
,voice
- Name
instructions
- Type
- string
- Required
- optional
- Description
This is the most important part of the agent. It tells the agent what it is supposed to do. For example, you can tell the agent that it is a sales agent and it should help the user with their purchase. Make it as specific as possible. Edit this later if you want to make changes and improve responses.
Default: "You are a helpful assistant."
- Name
description
- Type
- string
- Required
- optional
- Description
Give a short description of the agent. This information is not used for training the agent and is only for display purposes.
- Name
coverimage
- Type
- string
- Required
- optional
- Description
URL of the cover image for the agent. Recommended size is 512px x 512px.
- Name
intromessage
- Type
- string
- Required
- optional
- Description
This is the first message that the agent will send to the user. You can use this to greet the user and set the context for the conversation. In voice agents, this message is adapted to the first response received from the user.
- Name
knowledge_search
- Type
- boolean
- Required
- optional
- Description
Enable knowledge base search.
- Name
knowledge_id
- Type
- string
- Required
- optional
- Description
Knowledge Base ID to be used by the agent for answering queries.
Request
{
"coverimage": "https://www.burgersinghonline.com/wp-content/themes/burger-singh/front/images/logo-v=0.1.png",
"title": "My First AI Agent",
"description": "Ask me anything",
"intromessage": "How can I help you today?",
"instructions": "You are a helpful assistant. Answer the questions based on the information you are given. If answer is not available in the context, try to navigate the conversation smartly. Answer in English only.",
"knowledge_search": true,
"knowledge_id": "myfirstaiagent_1733206677149149"
}
Response
{
"response": "success"
}
Delete Agent
Deletes an agent.
What's deleted? Logs, admins, and other settings are deleted.
What's not deleted? Connected knowledge base, forms and contacts are not deleted.
Path parameters
- Name
namespace
- Type
- string
- Required
- required
- Description
The namespace of the agent.
Response
{
"response": "successfully deleted"
}
Chat
Chat with the agent.
This is a streaming API. Responses are sent as they are generated.
Path parameters
- Name
namespace
- Type
- string
- Required
- required
- Description
The namespace of the agent.
Request body
- Name
session_id
- Type
- string
- Required
- optional
- Description
A unique session id.
- Name
messages
- Type
- array
- Required
- required
- Description
A list of messages comprising the conversation so far.
- Name
messages > role
- Type
- string
- Required
- required
- Description
Options -
assistant
,user
,system
- Name
messages > content
- Type
- string
- Required
- required
- Description
The message content.
Response
Chat responses are streaming by default. Three types of objects are returned for each query
Object | Description | Type |
---|---|---|
chat.completion.knowledge | this contains the details of source | array |
chat.completion.latency | latency of response | string |
chat.completion.chunk | response chunk | string |
Request
{
"session_id": "niusjndckj23",
"messages": [
{
"role": "assistant",
"content": "how are you?"
},
{
"role": "user",
"content": "doing good. thank you."
}
]
}