Invoke Agent
curl --request POST \
--url https://api.example.com/runimport requests
url = "https://api.example.com/run"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/run', 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.example.com/run",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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.example.com/run"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/run")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/run")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyLAPI HTTP Server
Invoke Agent
Execute an agent on the fly with custom prompt, session ID, and dynamic keys
POST
/
run
Invoke Agent
curl --request POST \
--url https://api.example.com/runimport requests
url = "https://api.example.com/run"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/run', 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.example.com/run",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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.example.com/run"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/run")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/run")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyRequest Headers
Content-Type: application/jsonx-sarvam-api-key: <string>(optional on-the-fly key)
Request Body
{
"agent": "identity-agent",
"prompt": "Verify PAN number ABCDE1234F and check if format is valid",
"sessionId": "0192e3a1-7b82-7f91-8abc-123456789abc",
"keys": {
"SARVAM_API_KEY": "sk_live_..."
}
}
Response
200 OK
{
"output": "PAN ABCDE1234F is valid. Entity classification: Company.",
"sessionId": "0192e3a1-7b82-7f91-8abc-123456789abc",
"steps": [
{
"step": 1,
"thought": "The user wants to verify PAN ABCDE1234F. I will call verify_identity.",
"action": "verify_identity",
"toolInput": {
"type": "pan",
"value": "ABCDE1234F"
},
"observation": {
"valid": true,
"masked": "XXXXX1234X",
"entityType": "Company"
}
}
],
"toolsUsed": ["verify_identity"]
}