Registrar Agente
curl --request POST \
--url https://api.truthlocks.com/v1/agents \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"display_name": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({display_name: '<string>'})
};
fetch('https://api.truthlocks.com/v1/agents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/agents"
payload = { "display_name": "<string>" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/agents"
payload := strings.NewReader("{\n \"display_name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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))
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_type": "orchestrator",
"display_name": "<string>",
"description": "<string>",
"status": "active",
"scopes": [
"<string>"
],
"metadata": {},
"trust_score": 0.5,
"public_key": "<string>",
"session_count": 123,
"keys": [
{
"kid": "<string>",
"algorithm": "<string>",
"public_key": "<string>",
"status": "active"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Agentes de Máquina
Registrar Agente
Registrar uma nova identidade de agente de máquina com par de chaves criptográficas e permissões com escopo
POST
/
v1
/
agents
Registrar Agente
curl --request POST \
--url https://api.truthlocks.com/v1/agents \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"display_name": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({display_name: '<string>'})
};
fetch('https://api.truthlocks.com/v1/agents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/agents"
payload = { "display_name": "<string>" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/agents"
payload := strings.NewReader("{\n \"display_name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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))
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_type": "orchestrator",
"display_name": "<string>",
"description": "<string>",
"status": "active",
"scopes": [
"<string>"
],
"metadata": {},
"trust_score": 0.5,
"public_key": "<string>",
"session_count": 123,
"keys": [
{
"kid": "<string>",
"algorithm": "<string>",
"public_key": "<string>",
"status": "active"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Registrar Agente
POST /v1/agents
Regista uma nova identidade de agente de máquina para o inquilino autenticado. A plataforma gera um par de chaves Ed25519 para o agente, atribui um ID de agente compatível com MAIP e regista a chave inicial no livro-razão do histórico de chaves. Os agentes recém-registados começam com o estado active e uma pontuação de confiança inicial de 0.500.
O número de agentes que você pode registrar depende do seu plano de faturamento. Se você
exceder o limite do seu plano, a API retorna
402 Payment Required. Entre em contato com as vendas
para limites de agentes de nível empresarial.Autenticação
Requer cabeçalhoX-API-Key ou token JWT de portador. O espaço de trabalho é derivado da credencial autenticada; não envie X-Tenant-ID.
Resposta
Identificador de agente compatível com MAIP no formato
maip:<tenant8>:<ulid>. Use este valor
em todas as chamadas de API subsequentes que referenciam este agente.Chave pública Ed25519 codificada em Base64url gerada para este agente. Armazene esta
com segurança para verificação de assinatura.
Identificador único para a chave de assinatura do agente. Referenciado em recibos e
atestações.
Profundidade atual da cadeia de delegação. Sempre
0 para agentes diretamente registrados.
A profundidade máxima é 8 por protocolo MAIP.Exemplo
curl -X POST https://api.truthlocks.com/v1/agents \
-H "X-API-Key: tl_live_..." \
-H "Content-Type: application/json" \
-d '{
"agent_type": "llm",
"display_name": "Customer Support Bot",
"description": "Handles Tier-1 customer support inquiries via chat",
"scopes": ["data:read", "tool:search.web", "!data:delete"],
"metadata": {
"team": "support",
"model": "claude-3.5-sonnet",
"environment": "production"
}
}'
Corpo
application/json
Resposta
Agente registrado

