Tool registrieren
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
}Agentensitzungen & Tools
Tool registrieren
Registrieren Sie ein Tool im MAIP-Tool-Register mit Bereichsanforderungen, Risikoklassifizierung und Ratenbegrenzungen
POST
/
v1
/
tools
Tool registrieren
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
}Tool registrieren
POST /v1/tools
Registriert ein neues Tool im MAIP-Tool-Register des Mandanten. Tools repräsentieren externe Fähigkeiten (APIs, Funktionen, Dienste), die Maschinenagenten aufrufen können. Jedes Tool ist mit einem erforderlichen Geltungsbereich, einem Risikograd und einem optionalen Genehmigungs-Gate verbunden.
Die Plattform erhöht das Risikoniveau automatisch auf "high", wenn der Toolname oder der erforderliche Umfang gefährliche Aktionsverben (schreiben, löschen, senden, ausführen, bereitstellen, zerstören, löschen, kürzen) enthält.
Werkzeugnamen müssen pro Mandant eindeutig sein. Der Versuch, ein Werkzeug mit einem
Name, der bereits existiert, gibt
409 Conflict zurück.Authentifizierung
ErfordertX-API-Key Header oder Bearer JWT Token. Der Arbeitsbereich wird aus den authentifizierten Anmeldeinformationen abgeleitet; senden Sie X-Tenant-ID nicht.
Antwort
Beispiel
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
}
}'
Automatische Erhöhung des Risikolevels
Die Plattform scannt Toolnamen und Scope-Anforderungen nach gefährlichen Aktionsverben. Bei Erkennung wird das Risikoniveau automatisch erhöht:| Erkanntes Verb | Auto-Erhöhung |
|---|---|
write, delete, send | Erhöht auf "high" |
execute, deploy, destroy | Erhöht auf "high" |
drop, truncate | Erhöht auf "high" |
"critical" erfordern immer eine menschliche Genehmigung, unabhängig von der Einstellung requires_approval.Autorisierungen
Body
application/json

