Registrar herramienta
curl --request POST \
--url https://api.truthlocks.com/v1/tools \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"display_name": "<string>",
"name": "<string>",
"scope_required": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({display_name: '<string>', name: '<string>', scope_required: '<string>'})
};
fetch('https://api.truthlocks.com/v1/tools', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/tools"
payload = {
"display_name": "<string>",
"name": "<string>",
"scope_required": "<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/tools"
payload := strings.NewReader("{\n \"display_name\": \"<string>\",\n \"name\": \"<string>\",\n \"scope_required\": \"<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))
}{
"tool_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"schema": {},
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_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
}Sesiones y Herramientas de Agente
Registrar herramienta
Registrar una herramienta en el registro de herramientas MAIP con requisitos de alcance, clasificación de riesgos y límites de velocidad
POST
/
v1
/
tools
Registrar herramienta
curl --request POST \
--url https://api.truthlocks.com/v1/tools \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"display_name": "<string>",
"name": "<string>",
"scope_required": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({display_name: '<string>', name: '<string>', scope_required: '<string>'})
};
fetch('https://api.truthlocks.com/v1/tools', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/tools"
payload = {
"display_name": "<string>",
"name": "<string>",
"scope_required": "<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/tools"
payload := strings.NewReader("{\n \"display_name\": \"<string>\",\n \"name\": \"<string>\",\n \"scope_required\": \"<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))
}{
"tool_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"schema": {},
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_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 Herramienta
POST /v1/tools
Registra una nueva herramienta en el registro de herramientas MAIP del inquilino. Las herramientas representan capacidades externas (APIs, funciones, servicios) que los agentes de máquina pueden invocar. Cada herramienta está asociada con un alcance requerido, nivel de riesgo y una puerta de aprobación opcional.
La plataforma eleva automáticamente el nivel de riesgo a "high" si el nombre de la herramienta o el alcance requerido contiene verbos de acción peligrosos (escribir, eliminar, enviar, ejecutar, desplegar, destruir, soltar, truncar).
Los nombres de las herramientas deben ser únicos por inquilino. Intentar registrar una herramienta con un
que ya existe devuelve
409 Conflict.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
Ejemplo
curl -X POST https://api.truthlocks.com/v1/tools \
-H "X-API-Key: tl_live_..." \
-H "Content-Type: application/json" \
-d '{
"name": "search.web",
"display_name": "Web Search",
"description": "Performs web searches via SerpAPI and returns structured results",
"scope_required": "tool:search.web",
"risk_level": "low",
"rate_limit_per_minute": 30,
"category": "search",
"metadata": {
"endpoint_url": "https://serpapi.com/search",
"auth_type": "api_key",
"max_results": 10
}
}'
Elevación automática del nivel de riesgo
La plataforma escanea los nombres de las herramientas y los requisitos de alcance en busca de verbos de acción peligrosos. Si se detectan, el nivel de riesgo se eleva automáticamente:| Verbo detectado | Elevación automática |
|---|---|
write, delete, send | Elevado a "high" |
execute, deploy, destroy | Elevado a "high" |
drop, truncate | Elevado a "high" |
"critical" siempre requieren aprobación humana, independientemente de la configuración de requires_approval.Cuerpo
application/json

