Infer Agent Memory Schema
curl --request POST \
--url https://api.bland.ai/v2/agents/{agent_id}/memory/schema/infer \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '{
"snapshot": {}
}'import requests
url = "https://api.bland.ai/v2/agents/{agent_id}/memory/schema/infer"
payload = { "snapshot": {} }
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({snapshot: {}})
};
fetch('https://api.bland.ai/v2/agents/{agent_id}/memory/schema/infer', 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.bland.ai/v2/agents/{agent_id}/memory/schema/infer",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'snapshot' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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.bland.ai/v2/agents/{agent_id}/memory/schema/infer"
payload := strings.NewReader("{\n \"snapshot\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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.post("https://api.bland.ai/v2/agents/{agent_id}/memory/schema/infer")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"snapshot\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v2/agents/{agent_id}/memory/schema/infer")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"snapshot\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"entity_schemas": [
{
"entity_type": "appointment",
"description": "A dental appointment the caller books, moves, or cancels.",
"identifier_field": "confirmation_number",
"fields": [
{
"name": "confirmation_number",
"description": "The booking reference given to the caller.",
"type": "string",
"required": true
}
],
"outcomes": ["booked", "cancelled"]
}
]
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "AGENT_VERSION_NOT_FOUND",
"message": "Agent has no saved versions yet (agent_version: \"dev\")"
}
]
}
{
"data": null,
"errors": [
{
"error": "AGENT_SNAPSHOT_INVALID",
"message": "Agent version snapshot failed to compile"
}
]
}
{
"data": null,
"errors": [
{
"error": "NOT_FOUND",
"message": "Agent not found"
}
]
}
Memory
Infer Agent Memory Schema
Generate a suggested memory schema by reading the agent.
POST
/
v2
/
agents
/
{agent_id}
/
memory
/
schema
/
infer
Infer Agent Memory Schema
curl --request POST \
--url https://api.bland.ai/v2/agents/{agent_id}/memory/schema/infer \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '{
"snapshot": {}
}'import requests
url = "https://api.bland.ai/v2/agents/{agent_id}/memory/schema/infer"
payload = { "snapshot": {} }
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({snapshot: {}})
};
fetch('https://api.bland.ai/v2/agents/{agent_id}/memory/schema/infer', 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.bland.ai/v2/agents/{agent_id}/memory/schema/infer",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'snapshot' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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.bland.ai/v2/agents/{agent_id}/memory/schema/infer"
payload := strings.NewReader("{\n \"snapshot\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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.post("https://api.bland.ai/v2/agents/{agent_id}/memory/schema/infer")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"snapshot\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v2/agents/{agent_id}/memory/schema/infer")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"snapshot\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"entity_schemas": [
{
"entity_type": "appointment",
"description": "A dental appointment the caller books, moves, or cancels.",
"identifier_field": "confirmation_number",
"fields": [
{
"name": "confirmation_number",
"description": "The booking reference given to the caller.",
"type": "string",
"required": true
}
],
"outcomes": ["booked", "cancelled"]
}
]
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "AGENT_VERSION_NOT_FOUND",
"message": "Agent has no saved versions yet (agent_version: \"dev\")"
}
]
}
{
"data": null,
"errors": [
{
"error": "AGENT_SNAPSHOT_INVALID",
"message": "Agent version snapshot failed to compile"
}
]
}
{
"data": null,
"errors": [
{
"error": "NOT_FOUND",
"message": "Agent not found"
}
]
}
Overview
Reads the agent and proposes what it should remember about each contact. The proposal is returned and nothing is saved: to keep it, put it onsettings.memorySchema and save a version with Create Agent Version.
By default it reads the agent’s newest dev version. Send a snapshot to have it read an unsaved configuration instead, which is what the builder does while you are still editing.
This runs a language model over the compiled agent, so it is limited to 6 requests per minute per agent and it is not instant. The agent must have a saved version, or a snapshot in the body, and that configuration must compile.
Requires an admin, owner, operator, or prompter role.
Headers
string
required
Your API key for authentication.
Path Parameters
string
required
The agent’s unique identifier.
Body Parameters
object
A full agent configuration to read instead of the saved dev version, in the same shape Create Agent Version accepts. Validated before use: structural problems return
400 INVALID_SNAPSHOT with one entry per problem. Omit the field entirely to use the newest dev version.Response
array
The proposed entity types, in the same shape as Get Agent Memory Schema. Nothing is persisted.
null | array
null on success, or a list of error objects if the request failed. An agent with no saved version returns 404 AGENT_VERSION_NOT_FOUND, and a configuration that cannot be compiled returns 400 AGENT_SNAPSHOT_INVALID.{
"data": {
"entity_schemas": [
{
"entity_type": "appointment",
"description": "A dental appointment the caller books, moves, or cancels.",
"identifier_field": "confirmation_number",
"fields": [
{
"name": "confirmation_number",
"description": "The booking reference given to the caller.",
"type": "string",
"required": true
}
],
"outcomes": ["booked", "cancelled"]
}
]
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "AGENT_VERSION_NOT_FOUND",
"message": "Agent has no saved versions yet (agent_version: \"dev\")"
}
]
}
{
"data": null,
"errors": [
{
"error": "AGENT_SNAPSHOT_INVALID",
"message": "Agent version snapshot failed to compile"
}
]
}
{
"data": null,
"errors": [
{
"error": "NOT_FOUND",
"message": "Agent not found"
}
]
}
Docs for agents: llms.txt
Was this page helpful?