Python
# After your instructions, before the customer's context; cached and revalidated by ETag
notes = niadra.agent_memory(max_tokens=300, tags=["scheduling"])
system_prompt = "\n\n".join(part for part in (AGENT_INSTRUCTIONS, notes.text, ctx.system_block) if part)// After your instructions, before the customer's context; cached and revalidated by ETag
const notes = await niadra.agentMemory({ max_tokens: 300, tags: ["scheduling"] });
const system = [AGENT_INSTRUCTIONS, notes.text, ctx.text].filter(Boolean).join("\n\n");curl --request GET \
--url https://{space}.{region}.api.niadra.com/v1/agent-memory/block \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{space}.{region}.api.niadra.com/v1/agent-memory/block', 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://{space}.{region}.api.niadra.com/v1/agent-memory/block",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://{space}.{region}.api.niadra.com/v1/agent-memory/block"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{space}.{region}.api.niadra.com/v1/agent-memory/block")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/agent-memory/block")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"etag": "<string>",
"text": "<string>",
"enabled": true,
"notes": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"tokens": 0
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Memória do agente
Bloco da memória do agente
As notas de trabalho do agente como um bloco para o prompt, depois das instruções e antes do contexto do cliente, com ETag.
GET
/
v1
/
agent-memory
/
block
Python
# After your instructions, before the customer's context; cached and revalidated by ETag
notes = niadra.agent_memory(max_tokens=300, tags=["scheduling"])
system_prompt = "\n\n".join(part for part in (AGENT_INSTRUCTIONS, notes.text, ctx.system_block) if part)// After your instructions, before the customer's context; cached and revalidated by ETag
const notes = await niadra.agentMemory({ max_tokens: 300, tags: ["scheduling"] });
const system = [AGENT_INSTRUCTIONS, notes.text, ctx.text].filter(Boolean).join("\n\n");curl --request GET \
--url https://{space}.{region}.api.niadra.com/v1/agent-memory/block \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{space}.{region}.api.niadra.com/v1/agent-memory/block', 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://{space}.{region}.api.niadra.com/v1/agent-memory/block",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://{space}.{region}.api.niadra.com/v1/agent-memory/block"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{space}.{region}.api.niadra.com/v1/agent-memory/block")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/agent-memory/block")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"etag": "<string>",
"text": "<string>",
"enabled": true,
"notes": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"tokens": 0
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Autorizações
sourceKeypersonToken
nia_sk_...
Cabeçalhos
O etag que você já tem. Sem mudança, a resposta é 304.
Parâmetros de consulta
Orçamento do bloco, de 50 a 2.000 tokens; 300 por padrão.
Intervalo obrigatório:
50 <= x <= 2000As notas com estas tags vêm primeiro. Até 8.
Maximum array length:
8Pattern:
^[a-z0-9][a-z0-9_.:-]{0,63}$A view ou a tarefa em que o agente trabalha, para as notas marcadas para ela virem primeiro.
Só para pessoas: o agente cujo bloco se quer ver.
Resposta
O bloco, com o ETag no cabeçalho.
O bloco que entra no prompt depois das instruções do agente e antes do contexto do cliente: igual para todos os clientes, então fica no prefixo que o provedor guarda em cache.

