Update a custom agent
curl --request PUT \
--url https://api.pawa-ai.com/v1/agents/update/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "TutorAI",
"description": "TutorAI is an AI agent designed to assist students with their studies.",
"instruction": "Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to",
"intents": [
"Be gentle",
"Be detailed"
],
"knowledgeBaseId": 159,
"tools": [
{
"type": "function",
"function": {
"name": "convert_usd_to_tsh",
"description": "Converts an amount in USD to Tanzanian Shillings.",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"amount_usd": {
"description": "Amount in USD",
"type": "number"
}
},
"required": [
"amount_usd"
],
"additionalProperties": false
}
}
},
{
"type": "pawa_tool",
"pawa_tool": "web_search_tool"
}
]
}
'import requests
url = "https://api.pawa-ai.com/v1/agents/update/{id}"
payload = {
"name": "TutorAI",
"description": "TutorAI is an AI agent designed to assist students with their studies.",
"instruction": "Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to",
"intents": ["Be gentle", "Be detailed"],
"knowledgeBaseId": 159,
"tools": [
{
"type": "function",
"function": {
"name": "convert_usd_to_tsh",
"description": "Converts an amount in USD to Tanzanian Shillings.",
"strict": True,
"parameters": {
"type": "object",
"properties": { "amount_usd": {
"description": "Amount in USD",
"type": "number"
} },
"required": ["amount_usd"],
"additionalProperties": False
}
}
},
{
"type": "pawa_tool",
"pawa_tool": "web_search_tool"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'TutorAI',
description: 'TutorAI is an AI agent designed to assist students with their studies.',
instruction: 'Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to',
intents: ['Be gentle', 'Be detailed'],
knowledgeBaseId: 159,
tools: [
{
type: 'function',
function: {
name: 'convert_usd_to_tsh',
description: 'Converts an amount in USD to Tanzanian Shillings.',
strict: true,
parameters: {
type: 'object',
properties: {amount_usd: {description: 'Amount in USD', type: 'number'}},
required: ['amount_usd'],
additionalProperties: false
}
}
},
{type: 'pawa_tool', pawa_tool: 'web_search_tool'}
]
})
};
fetch('https://api.pawa-ai.com/v1/agents/update/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pawa-ai.com/v1/agents/update/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'TutorAI',
'description' => 'TutorAI is an AI agent designed to assist students with their studies.',
'instruction' => 'Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to',
'intents' => [
'Be gentle',
'Be detailed'
],
'knowledgeBaseId' => 159,
'tools' => [
[
'type' => 'function',
'function' => [
'name' => 'convert_usd_to_tsh',
'description' => 'Converts an amount in USD to Tanzanian Shillings.',
'strict' => true,
'parameters' => [
'type' => 'object',
'properties' => [
'amount_usd' => [
'description' => 'Amount in USD',
'type' => 'number'
]
],
'required' => [
'amount_usd'
],
'additionalProperties' => false
]
]
],
[
'type' => 'pawa_tool',
'pawa_tool' => 'web_search_tool'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pawa-ai.com/v1/agents/update/{id}"
payload := strings.NewReader("{\n \"name\": \"TutorAI\",\n \"description\": \"TutorAI is an AI agent designed to assist students with their studies.\",\n \"instruction\": \"Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to\",\n \"intents\": [\n \"Be gentle\",\n \"Be detailed\"\n ],\n \"knowledgeBaseId\": 159,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"convert_usd_to_tsh\",\n \"description\": \"Converts an amount in USD to Tanzanian Shillings.\",\n \"strict\": true,\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"amount_usd\": {\n \"description\": \"Amount in USD\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"amount_usd\"\n ],\n \"additionalProperties\": false\n }\n }\n },\n {\n \"type\": \"pawa_tool\",\n \"pawa_tool\": \"web_search_tool\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.pawa-ai.com/v1/agents/update/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"TutorAI\",\n \"description\": \"TutorAI is an AI agent designed to assist students with their studies.\",\n \"instruction\": \"Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to\",\n \"intents\": [\n \"Be gentle\",\n \"Be detailed\"\n ],\n \"knowledgeBaseId\": 159,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"convert_usd_to_tsh\",\n \"description\": \"Converts an amount in USD to Tanzanian Shillings.\",\n \"strict\": true,\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"amount_usd\": {\n \"description\": \"Amount in USD\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"amount_usd\"\n ],\n \"additionalProperties\": false\n }\n }\n },\n {\n \"type\": \"pawa_tool\",\n \"pawa_tool\": \"web_search_tool\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pawa-ai.com/v1/agents/update/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"TutorAI\",\n \"description\": \"TutorAI is an AI agent designed to assist students with their studies.\",\n \"instruction\": \"Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to\",\n \"intents\": [\n \"Be gentle\",\n \"Be detailed\"\n ],\n \"knowledgeBaseId\": 159,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"convert_usd_to_tsh\",\n \"description\": \"Converts an amount in USD to Tanzanian Shillings.\",\n \"strict\": true,\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"amount_usd\": {\n \"description\": \"Amount in USD\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"amount_usd\"\n ],\n \"additionalProperties\": false\n }\n }\n },\n {\n \"type\": \"pawa_tool\",\n \"pawa_tool\": \"web_search_tool\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Agent updated successfully",
"data": {
"id": 0,
"agentReferenceId": "67cf5354-89f0-8001-b038-b2645377b214",
"name": "TutorAI",
"description": "TutorAI is an AI agent designed to assist students with their studies.",
"instruction": "Teaching students on subjects ranging from form one to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to",
"status": "ACTIVE",
"createdAt": "2021-09-01T00:00:00.000Z",
"updatedAt": "2021-09-01T00:00:00.000Z"
}
}{
"success": false,
"message": "Invalid input provided"
}{
"success": false,
"message": "Unauthorized access"
}{
"success": false,
"message": "You do not have permission to access this resource"
}{
"success": false,
"message": "Resource does not exist"
}{
"success": false,
"message": "Rate limit exceeded. Please try again later."
}{
"success": false,
"message": "Internal server error"
}Agents
Edit Agent
This endpoint used to update the custom agent in the Pawa AI Platform.
PUT
/
agents
/
update
/
{id}
Update a custom agent
curl --request PUT \
--url https://api.pawa-ai.com/v1/agents/update/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "TutorAI",
"description": "TutorAI is an AI agent designed to assist students with their studies.",
"instruction": "Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to",
"intents": [
"Be gentle",
"Be detailed"
],
"knowledgeBaseId": 159,
"tools": [
{
"type": "function",
"function": {
"name": "convert_usd_to_tsh",
"description": "Converts an amount in USD to Tanzanian Shillings.",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"amount_usd": {
"description": "Amount in USD",
"type": "number"
}
},
"required": [
"amount_usd"
],
"additionalProperties": false
}
}
},
{
"type": "pawa_tool",
"pawa_tool": "web_search_tool"
}
]
}
'import requests
url = "https://api.pawa-ai.com/v1/agents/update/{id}"
payload = {
"name": "TutorAI",
"description": "TutorAI is an AI agent designed to assist students with their studies.",
"instruction": "Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to",
"intents": ["Be gentle", "Be detailed"],
"knowledgeBaseId": 159,
"tools": [
{
"type": "function",
"function": {
"name": "convert_usd_to_tsh",
"description": "Converts an amount in USD to Tanzanian Shillings.",
"strict": True,
"parameters": {
"type": "object",
"properties": { "amount_usd": {
"description": "Amount in USD",
"type": "number"
} },
"required": ["amount_usd"],
"additionalProperties": False
}
}
},
{
"type": "pawa_tool",
"pawa_tool": "web_search_tool"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'TutorAI',
description: 'TutorAI is an AI agent designed to assist students with their studies.',
instruction: 'Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to',
intents: ['Be gentle', 'Be detailed'],
knowledgeBaseId: 159,
tools: [
{
type: 'function',
function: {
name: 'convert_usd_to_tsh',
description: 'Converts an amount in USD to Tanzanian Shillings.',
strict: true,
parameters: {
type: 'object',
properties: {amount_usd: {description: 'Amount in USD', type: 'number'}},
required: ['amount_usd'],
additionalProperties: false
}
}
},
{type: 'pawa_tool', pawa_tool: 'web_search_tool'}
]
})
};
fetch('https://api.pawa-ai.com/v1/agents/update/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pawa-ai.com/v1/agents/update/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'TutorAI',
'description' => 'TutorAI is an AI agent designed to assist students with their studies.',
'instruction' => 'Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to',
'intents' => [
'Be gentle',
'Be detailed'
],
'knowledgeBaseId' => 159,
'tools' => [
[
'type' => 'function',
'function' => [
'name' => 'convert_usd_to_tsh',
'description' => 'Converts an amount in USD to Tanzanian Shillings.',
'strict' => true,
'parameters' => [
'type' => 'object',
'properties' => [
'amount_usd' => [
'description' => 'Amount in USD',
'type' => 'number'
]
],
'required' => [
'amount_usd'
],
'additionalProperties' => false
]
]
],
[
'type' => 'pawa_tool',
'pawa_tool' => 'web_search_tool'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pawa-ai.com/v1/agents/update/{id}"
payload := strings.NewReader("{\n \"name\": \"TutorAI\",\n \"description\": \"TutorAI is an AI agent designed to assist students with their studies.\",\n \"instruction\": \"Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to\",\n \"intents\": [\n \"Be gentle\",\n \"Be detailed\"\n ],\n \"knowledgeBaseId\": 159,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"convert_usd_to_tsh\",\n \"description\": \"Converts an amount in USD to Tanzanian Shillings.\",\n \"strict\": true,\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"amount_usd\": {\n \"description\": \"Amount in USD\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"amount_usd\"\n ],\n \"additionalProperties\": false\n }\n }\n },\n {\n \"type\": \"pawa_tool\",\n \"pawa_tool\": \"web_search_tool\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.pawa-ai.com/v1/agents/update/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"TutorAI\",\n \"description\": \"TutorAI is an AI agent designed to assist students with their studies.\",\n \"instruction\": \"Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to\",\n \"intents\": [\n \"Be gentle\",\n \"Be detailed\"\n ],\n \"knowledgeBaseId\": 159,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"convert_usd_to_tsh\",\n \"description\": \"Converts an amount in USD to Tanzanian Shillings.\",\n \"strict\": true,\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"amount_usd\": {\n \"description\": \"Amount in USD\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"amount_usd\"\n ],\n \"additionalProperties\": false\n }\n }\n },\n {\n \"type\": \"pawa_tool\",\n \"pawa_tool\": \"web_search_tool\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pawa-ai.com/v1/agents/update/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"TutorAI\",\n \"description\": \"TutorAI is an AI agent designed to assist students with their studies.\",\n \"instruction\": \"Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to\",\n \"intents\": [\n \"Be gentle\",\n \"Be detailed\"\n ],\n \"knowledgeBaseId\": 159,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"convert_usd_to_tsh\",\n \"description\": \"Converts an amount in USD to Tanzanian Shillings.\",\n \"strict\": true,\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"amount_usd\": {\n \"description\": \"Amount in USD\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"amount_usd\"\n ],\n \"additionalProperties\": false\n }\n }\n },\n {\n \"type\": \"pawa_tool\",\n \"pawa_tool\": \"web_search_tool\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Agent updated successfully",
"data": {
"id": 0,
"agentReferenceId": "67cf5354-89f0-8001-b038-b2645377b214",
"name": "TutorAI",
"description": "TutorAI is an AI agent designed to assist students with their studies.",
"instruction": "Teaching students on subjects ranging from form one to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to",
"status": "ACTIVE",
"createdAt": "2021-09-01T00:00:00.000Z",
"updatedAt": "2021-09-01T00:00:00.000Z"
}
}{
"success": false,
"message": "Invalid input provided"
}{
"success": false,
"message": "Unauthorized access"
}{
"success": false,
"message": "You do not have permission to access this resource"
}{
"success": false,
"message": "Resource does not exist"
}{
"success": false,
"message": "Rate limit exceeded. Please try again later."
}{
"success": false,
"message": "Internal server error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json
The name of the agent
Example:
"TutorAI"
The description about the agent
Example:
"TutorAI is an AI agent designed to assist students with their studies."
What should the agent do
Example:
"Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to"
The list of intents, how the model should behave?
Example:
["Be gentle", "Be detailed"]
The knowledge base ID to be used by the agent
Example:
159
Tools to provide to the model (as a JSON string). Eg. Built-in tools includes web_search_tool
- Custom Tools
- Built-In Tools
Show child attributes
Show child attributes
Example:
[
{
"type": "function",
"function": {
"name": "convert_usd_to_tsh",
"description": "Converts an amount in USD to Tanzanian Shillings.",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"amount_usd": {
"description": "Amount in USD",
"type": "number"
}
},
"required": ["amount_usd"],
"additionalProperties": false
}
}
},
{
"type": "pawa_tool",
"pawa_tool": "web_search_tool"
}
]
⌘I