Get agent invocation
curl --request GET \
--url https://api.trymaitai.ai/api/v1/agents/{agent_id}/invocations/{task_id} \
--header 'X-Maitai-Api-Key: <api-key>'import requests
url = "https://api.trymaitai.ai/api/v1/agents/{agent_id}/invocations/{task_id}"
headers = {"X-Maitai-Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Maitai-Api-Key': '<api-key>'}};
fetch('https://api.trymaitai.ai/api/v1/agents/{agent_id}/invocations/{task_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.trymaitai.ai/api/v1/agents/{agent_id}/invocations/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Maitai-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.trymaitai.ai/api/v1/agents/{agent_id}/invocations/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Maitai-Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.trymaitai.ai/api/v1/agents/{agent_id}/invocations/{task_id}")
.header("X-Maitai-Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trymaitai.ai/api/v1/agents/{agent_id}/invocations/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Maitai-Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"task_id": "9c2f7f3a-1b2c-4d5e-8f90-a1b2c3d4e5f6",
"status": "completed",
"response": "Sure — let's start with your business details."
}
}Agents
Get agent invocation
Poll an asynchronous agent invocation started with wait=false. Requires the request_id returned by the invoke call.
GET
/
agents
/
{agent_id}
/
invocations
/
{task_id}
Get agent invocation
curl --request GET \
--url https://api.trymaitai.ai/api/v1/agents/{agent_id}/invocations/{task_id} \
--header 'X-Maitai-Api-Key: <api-key>'import requests
url = "https://api.trymaitai.ai/api/v1/agents/{agent_id}/invocations/{task_id}"
headers = {"X-Maitai-Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Maitai-Api-Key': '<api-key>'}};
fetch('https://api.trymaitai.ai/api/v1/agents/{agent_id}/invocations/{task_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.trymaitai.ai/api/v1/agents/{agent_id}/invocations/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Maitai-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.trymaitai.ai/api/v1/agents/{agent_id}/invocations/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Maitai-Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.trymaitai.ai/api/v1/agents/{agent_id}/invocations/{task_id}")
.header("X-Maitai-Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trymaitai.ai/api/v1/agents/{agent_id}/invocations/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Maitai-Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"task_id": "9c2f7f3a-1b2c-4d5e-8f90-a1b2c3d4e5f6",
"status": "completed",
"response": "Sure — let's start with your business details."
}
}Authorizations
Your Maitai API key from the Portal.
Query Parameters
The request_id returned by the asynchronous invoke call.
Response
200 - application/json
Get agent invocation.
Was this page helpful?
⌘I