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 una nueva identidad de agente de máquina con par de claves criptográficas y permisos con ámbito
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
Registra una nueva identidad de agente de máquina para el inquilino autenticado. La plataforma genera un par de claves Ed25519 para el agente, asigna una ID de agente compatible con MAIP y registra la clave inicial en el libro mayor del historial de claves. Los agentes recién registrados comienzan con el estado active y una puntuación de confianza inicial de 0.500.
El número de agentes que puede registrar depende de su plan de facturación. Si
excede el límite de su plan, la API devuelve
402 Payment Required. Póngase en contacto con ventas
para límites de agentes de nivel empresarial.Autenticación
Requiere el encabezadoX-API-Key o el token Bearer JWT. El espacio de trabajo se deriva de la credencial autenticada; no envíe X-Tenant-ID.
Respuesta
Identificador de agente compatible con MAIP en formato
maip:<tenant8>:<ulid>. Use este valor
en todas las llamadas API posteriores que hagan referencia a este agente.Puntuación de confianza numérica (0.0 a 1.0). Los agentes recién registrados comienzan en
0.500.Clave pública Ed25519 codificada en Base64url generada para este agente. Almacene esto
de forma segura para la verificación de firmas.
Identificador único para la clave de firma del agente. Referenciado en recibos y
atestaciones.
Profundidad actual de la cadena de delegación. Siempre
0 para agentes registrados directamente.
La profundidad máxima es 8 por protocolo MAIP.Ejemplo
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"
}
}'
Cuerpo
application/json
Respuesta
Agente registrado

