تسجيل أداة
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
}جلسات وأدوات الوكيل
تسجيل أداة
تسجيل أداة في سجل أدوات MAIP مع متطلبات النطاق، وتصنيف المخاطر، وحدود المعدل
POST
/
v1
/
tools
تسجيل أداة
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
}تسجيل أداة
POST /v1/tools
يسجل أداة جديدة في سجل أدوات MAIP الخاص بالمستأجر. تمثل الأدوات قدرات خارجية (واجهات برمجة التطبيقات، الوظائف، الخدمات) يمكن لوكلاء الآلة استدعاؤها. ترتبط كل أداة بنطاق مطلوب ومستوى مخاطر وبوابة موافقة اختيارية.
ترفع المنصة تلقائيًا مستوى المخاطر إلى "high" إذا كان اسم الأداة أو النطاق المطلوب يحتوي على أفعال خطيرة (كتابة، حذف، إرسال، تنفيذ، نشر، تدمير، إسقاط، اقتطاع).
يجب أن تكون أسماء الأدوات فريدة لكل مستأجر. محاولة تسجيل أداة باسم
اسم موجود بالفعل يُرجع
409 Conflict.المصادقة
يتطلب رأسX-API-Key أو رمز Bearer JWT. يتم اشتقاق مساحة العمل من بيانات الاعتماد الموثقة؛ لا ترسل X-Tenant-ID.
الاستجابة
مثال
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
}
}'
الرفع التلقائي لمستوى المخاطر
تقوم المنصة بفحص أسماء الأدوات ومتطلبات النطاق بحثًا عن أفعال خطيرة. إذا تم اكتشافها، يتم رفع مستوى المخاطر تلقائيًا:| الفعل المكتشف | الرفع التلقائي |
|---|---|
write، delete، send | تم الرفع إلى "high" |
execute، deploy، destroy | تم الرفع إلى "high" |
drop، truncate | تم الرفع إلى "high" |
"critical" دائمًا موافقة بشرية بغض النظر عن إعداد requires_approval.الجسم
application/json

