Ajan Tanımları
Ajan tanımları, bir ajanın amacını, yeteneklerini ve yapılandırmasını tanımlayan şablonlardır. Tanımlardan sürümlü anlık görüntüler oluşturabilir, örnekleri dağıtabilir, kapsamlar atayabilir ve araçlar kaydedebilirsiniz.
Ajan Tanımları
Endpoint'ler
| Metot | Yol | Açıklama | Kimlik Doğrulama | Hız Limiti |
|---|---|---|---|---|
| GET | /agents/definitions | Tanımları listele | JWT + Yetki | 60/dk |
| GET | /agents/definitions/:id | Bir tanımı getir | JWT + Yetki | 60/dk |
| POST | /agents/definitions | Tanım oluştur | JWT + Yetki | 10/dk |
| PATCH | /agents/definitions/:id | Tanımı güncelle | JWT + Yetki | 30/dk |
| DELETE | /agents/definitions/:id | Tanımı sil | JWT + Yetki | 10/dk |
Tanım Oluşturma
İstek
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
name | string | Evet | Ajan adı |
description | string | Hayır | Ajan açıklaması |
type | string | Evet | assistant, worker, orchestrator |
systemPrompt | string | Hayır | Sistem düzeyinde talimatlar |
modelId | string | Hayır | Tercih edilen yapay zeka modeli kimliği |
tools | string[] | Hayır | Ajanın kullanabileceği araç kimlikleri |
config | object | Hayır | Ek yapılandırma |
modelId, mevcut bir yapay zeka modelinin id değeridir — $MODEL_ID olarak kullanın. tools, önceden kaydettiğiniz araçların id değerlerini listeler (aşağıdaki Araç Oluşturma bölümüne bakın) — bunları $TOOL_ID / $TOOL_ID_2 olarak kullanın.
Yanıt
{
"data": {
"id": "cm5def01",
"name": "Productivity Workflow Coach",
"description": "An agent specialized in helping users build and maintain productive workflows",
"type": "assistant",
"systemPrompt": "You are a productivity workflow expert...",
"modelId": "cm5model01",
"tools": ["cm5tool01", "cm5tool02"],
"config": { "temperature": 0.7, "maxTurns": 20 },
"createdAt": "2026-03-17T10:00:00.000Z",
"updatedAt": "2026-03-17T10:00:00.000Z"
}
}Kod Örnekleri
curl -X POST https://api.chainabit.com/api/v1/agents/definitions \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Productivity Workflow Coach",
"description": "An agent specialized in helping users build and maintain productive workflows",
"type": "assistant",
"systemPrompt": "You are a productivity workflow expert. Help users build sustainable routines.",
"modelId": "'$MODEL_ID'",
"tools": ["'$TOOL_ID'", "'$TOOL_ID_2'"],
"config": { "temperature": 0.7, "maxTurns": 20 }
}'const BASE_URL = process.env.BASE_URL;
const TOKEN = process.env.TOKEN;
const modelId = process.env.MODEL_ID; // AI Models API'den
const toolId = process.env.TOOL_ID; // Araç Oluşturma yanıtından (data.id)
const toolId2 = process.env.TOOL_ID_2;
const response = await fetch(`${BASE_URL}/agents/definitions`, {
method: "POST",
headers: {
Authorization: `Bearer ${TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Productivity Workflow Coach",
description: "An agent specialized in helping users build and maintain productive workflows",
type: "assistant",
systemPrompt: "You are a productivity workflow expert. Help users build sustainable routines.",
modelId: modelId,
tools: [toolId, toolId2],
config: { temperature: 0.7, maxTurns: 20 },
}),
});
const { data } = await response.json();import requests, os
model_id = os.environ["MODEL_ID"] # AI Models API'den
tool_id = os.environ["TOOL_ID"] # Araç Oluşturma yanıtından (data["id"])
tool_id_2 = os.environ["TOOL_ID_2"]
response = requests.post(
f"{os.environ['BASE_URL']}/agents/definitions",
headers={"Authorization": f"Bearer {os.environ['TOKEN']}"},
json={
"name": "Productivity Workflow Coach",
"description": "An agent specialized in helping users build and maintain productive workflows",
"type": "assistant",
"systemPrompt": "You are a productivity workflow expert. Help users build sustainable routines.",
"modelId": model_id,
"tools": [tool_id, tool_id_2],
"config": {"temperature": 0.7, "maxTurns": 20},
},
)
data = response.json()["data"]Tanımları Listeleme
İstek
Yol veya sorgu parametresi yoktur.
Yanıt
{
"data": [
{
"id": "cm5def01",
"name": "Productivity Workflow Coach",
"type": "assistant",
"createdAt": "2026-03-17T10:00:00.000Z"
}
],
"meta": { "total": 1 }
}Kod Örnekleri
curl https://api.chainabit.com/api/v1/agents/definitions \
-H "Authorization: Bearer $TOKEN"const BASE_URL = process.env.BASE_URL;
const TOKEN = process.env.TOKEN;
const response = await fetch(`${BASE_URL}/agents/definitions`, {
headers: { Authorization: `Bearer ${TOKEN}` },
});
const { data } = await response.json();import requests, os
response = requests.get(
f"{os.environ['BASE_URL']}/agents/definitions",
headers={"Authorization": f"Bearer {os.environ['TOKEN']}"},
)
data = response.json()["data"]Ajan Sürümleri
Tekrarlanabilirlik ve geri alma için ajan tanımlarının sürümlü anlık görüntülerini yönetin.
Endpoint'ler
| Metot | Yol | Açıklama | Kimlik Doğrulama | Hız Limiti |
|---|---|---|---|---|
| GET | /agents/versions | Sürümleri listele | JWT + Yetki | 60/dk |
| GET | /agents/versions/:id | Bir sürümü getir | JWT + Yetki | 60/dk |
| POST | /agents/versions | Sürüm oluştur | JWT + Yetki | 10/dk |
| PATCH | /agents/versions/:id | Sürümü güncelle | JWT + Yetki | 30/dk |
| DELETE | /agents/versions/:id | Sürümü sil | JWT + Yetki | 10/dk |
Sürümleri Listeleme
İstek
Yol veya sorgu parametresi yoktur.
Yanıt
{
"data": [
{
"id": "cm5ver01",
"definitionId": "cm5def01",
"version": "1.0.0",
"status": "published",
"createdAt": "2026-03-17T10:00:00.000Z"
}
],
"meta": { "total": 1 }
}Kod Örnekleri
curl https://api.chainabit.com/api/v1/agents/versions \
-H "Authorization: Bearer $TOKEN"const BASE_URL = process.env.BASE_URL;
const TOKEN = process.env.TOKEN;
const response = await fetch(`${BASE_URL}/agents/versions`, {
headers: { Authorization: `Bearer ${TOKEN}` },
});
const { data } = await response.json();import requests, os
response = requests.get(
f"{os.environ['BASE_URL']}/agents/versions",
headers={"Authorization": f"Bearer {os.environ['TOKEN']}"},
)
data = response.json()["data"]Ajan Örnekleri
Ajan tanımlarının çalışan örnekleri. Bir örnek, aktif bir dağıtımı temsil eder.
Endpoint'ler
| Metot | Yol | Açıklama | Kimlik Doğrulama | Hız Limiti |
|---|---|---|---|---|
| GET | /agents/instances | Örnekleri listele | JWT + Yetki | 60/dk |
| GET | /agents/instances/:id | Bir örneği getir | JWT + Yetki | 60/dk |
| POST | /agents/instances | Örnek oluştur | JWT + Yetki | 10/dk |
| PATCH | /agents/instances/:id | Örneği güncelle | JWT + Yetki | 30/dk |
| DELETE | /agents/instances/:id | Örneği sil | JWT + Yetki | 10/dk |
Örnek Oluşturma
İstek
Tanım Oluşturma yanıtındaki id değerini (data.id) $DEFINITION_ID olarak ve bir tanımın sürüm listesindeki id değerini (Ajan Sürümleri bölümündeki data[].id) $VERSION_ID olarak kullanın.
Yanıt
{
"data": {
"id": "cm5inst01",
"definitionId": "cm5def01",
"versionId": "cm5ver01",
"name": "My Workflow Coach",
"status": "active",
"createdAt": "2026-03-17T10:00:00.000Z"
}
}Kod Örnekleri
curl -X POST https://api.chainabit.com/api/v1/agents/instances \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"definitionId": "'$DEFINITION_ID'",
"versionId": "'$VERSION_ID'",
"name": "My Workflow Coach"
}'const BASE_URL = process.env.BASE_URL;
const TOKEN = process.env.TOKEN;
const definitionId = process.env.DEFINITION_ID; // Tanım Oluşturma yanıtından
const versionId = process.env.VERSION_ID; // Ajan Sürümleri yanıtından
const response = await fetch(`${BASE_URL}/agents/instances`, {
method: "POST",
headers: {
Authorization: `Bearer ${TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
definitionId: definitionId,
versionId: versionId,
name: "My Workflow Coach",
}),
});
const { data } = await response.json();import requests, os
definition_id = os.environ["DEFINITION_ID"] # Tanım Oluşturma yanıtından
version_id = os.environ["VERSION_ID"] # Ajan Sürümleri yanıtından
response = requests.post(
f"{os.environ['BASE_URL']}/agents/instances",
headers={"Authorization": f"Bearer {os.environ['TOKEN']}"},
json={
"definitionId": definition_id,
"versionId": version_id,
"name": "My Workflow Coach",
},
)
data = response.json()["data"]Kullanılabilir Örnekler
Hesabınıza erişilebilen aktif ajan örneklerini keşfedin — kendi ajanlarınız ile platformdaki herkese açık paylaşılmış ajanlar dahil. Sonuçlar görünen ada göre A-Z sırasıyla listelenir.
Endpoint
| Metot | Yol | Açıklama | Kimlik Doğrulama | Hız Limiti |
|---|---|---|---|---|
| GET | /agents/instances/available | Kullanılabilir ajanları listele | JWT + Yetki | 60/dk |
İstek
| Parametre | Tür | Varsayılan | Açıklama |
|---|---|---|---|
q | string | — | Ajan adı veya açıklamasına göre filtrele (büyük/küçük harf duyarsız, kısmi eşleşme) |
is_public | boolean | — | true = yalnızca herkese açık ajanlar · false = yalnızca kendi herkese açık olmayan ajanlarınız · belirtilmezse = her ikisi |
limit | integer (1–50) | 20 | Sayfa boyutu |
offset | integer (≥0) | 0 | Atlanacak kayıt sayısı |
Yanıt
{
"data": [
{
"id": "cm5inst01",
"displayName": "Productivity Workflow Coach",
"avatarUrl": null,
"isPublic": true,
"agentType": "custom",
"description": "An agent specialized in helping users build and maintain productive workflows",
"capabilities": ["chat", "tools"]
}
],
"meta": {
"limit": 10,
"offset": 0,
"total": 1,
"hasNextPage": false
}
}Kod Örnekleri
curl "https://api.chainabit.com/api/v1/agents/instances/available?q=coach&is_public=true&limit=10&offset=0" \
-H "Authorization: Bearer $TOKEN"const BASE_URL = process.env.BASE_URL;
const TOKEN = process.env.TOKEN;
const params = new URLSearchParams({ q: 'coach', is_public: 'true', limit: '10', offset: '0' });
const response = await fetch(`${BASE_URL}/agents/instances/available?${params}`, {
headers: { Authorization: `Bearer ${TOKEN}` },
});
const { data, meta } = await response.json();import requests, os
response = requests.get(
f"{os.environ['BASE_URL']}/agents/instances/available",
headers={"Authorization": f"Bearer {os.environ['TOKEN']}"},
params={"q": "coach", "is_public": "true", "limit": 10, "offset": 0},
)
payload = response.json()
data, meta = payload["data"], payload["meta"]Ajan Kapsamları
Bir ajanın çalışabileceği sınırları tanımlayın (ör. belirli zincirler, chainy'ler veya çalışma alanları).
Endpoint'ler
| Metot | Yol | Açıklama | Kimlik Doğrulama | Hız Limiti |
|---|---|---|---|---|
| GET | /agents/scopes | Kapsamları listele | JWT + Yetki | 60/dk |
| GET | /agents/scopes/:id | Bir kapsamı getir | JWT + Yetki | 60/dk |
| POST | /agents/scopes | Kapsam oluştur | JWT + Yetki | 30/dk |
| PATCH | /agents/scopes/:id | Kapsamı güncelle | JWT + Yetki | 30/dk |
| DELETE | /agents/scopes/:id | Kapsamı sil | JWT + Yetki | 30/dk |
Kapsam Oluşturma
İstek
Örnek Oluşturma yanıtındaki id değerini (data.id) $INSTANCE_ID olarak kullanın. targetId, kapsamı belirlenen kaynağın id değeridir (bu örnekte bir chainy) — kendi id değerini $CHAINY_ID olarak kullanın.
Yanıt
{
"data": {
"id": "cm5scope01",
"instanceId": "cm5inst01",
"type": "chainy",
"targetId": "cm5abc123",
"permissions": ["read", "suggest", "execute"],
"createdAt": "2026-03-17T10:00:00.000Z"
}
}Kod Örnekleri
curl -X POST https://api.chainabit.com/api/v1/agents/scopes \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"instanceId": "'$INSTANCE_ID'",
"type": "chainy",
"targetId": "'$CHAINY_ID'",
"permissions": ["read", "suggest", "execute"]
}'const BASE_URL = process.env.BASE_URL;
const TOKEN = process.env.TOKEN;
const instanceId = process.env.INSTANCE_ID; // Örnek Oluşturma yanıtından
const targetId = process.env.CHAINY_ID; // kapsamlanacak chainy (veya diğer kaynak)
const response = await fetch(`${BASE_URL}/agents/scopes`, {
method: "POST",
headers: {
Authorization: `Bearer ${TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
instanceId: instanceId,
type: "chainy",
targetId: targetId,
permissions: ["read", "suggest", "execute"],
}),
});
const { data } = await response.json();import requests, os
instance_id = os.environ["INSTANCE_ID"] # Örnek Oluşturma yanıtından
target_id = os.environ["CHAINY_ID"] # kapsamlanacak chainy (veya diğer kaynak)
response = requests.post(
f"{os.environ['BASE_URL']}/agents/scopes",
headers={"Authorization": f"Bearer {os.environ['TOKEN']}"},
json={
"instanceId": instance_id,
"type": "chainy",
"targetId": target_id,
"permissions": ["read", "suggest", "execute"],
},
)
data = response.json()["data"]Ajan Araçları
Ajanların yürütme sırasında çağırabileceği harici araçları ve entegrasyonları kaydedin.
Endpoint'ler
| Metot | Yol | Açıklama | Kimlik Doğrulama | Hız Limiti |
|---|---|---|---|---|
| GET | /agents/tools | Araçları listele | JWT + Yetki | 60/dk |
| GET | /agents/tools/:id | Bir aracı getir | JWT + Yetki | 60/dk |
| POST | /agents/tools | Araç oluştur | JWT + Yetki | 10/dk |
| PATCH | /agents/tools/:id | Aracı güncelle | JWT + Yetki | 30/dk |
| DELETE | /agents/tools/:id | Aracı sil | JWT + Yetki | 10/dk |
Araç Oluşturma
İstek
Yanıt
{
"data": {
"id": "cm5tool01",
"name": "Calendar Lookup",
"description": "Look up events from the user calendar",
"type": "api",
"schema": {},
"endpoint": "https://api.example.com/calendar",
"createdAt": "2026-03-17T10:00:00.000Z"
}
}Kod Örnekleri
curl -X POST https://api.chainabit.com/api/v1/agents/tools \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Calendar Lookup",
"description": "Look up events from the user calendar",
"type": "api",
"schema": {
"input": { "date": { "type": "string", "format": "date" } },
"output": { "events": { "type": "array" } }
},
"endpoint": "https://api.example.com/calendar"
}'const BASE_URL = process.env.BASE_URL;
const TOKEN = process.env.TOKEN;
const response = await fetch(`${BASE_URL}/agents/tools`, {
method: "POST",
headers: {
Authorization: `Bearer ${TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Calendar Lookup",
description: "Look up events from the user calendar",
type: "api",
schema: {
input: { date: { type: "string", format: "date" } },
output: { events: { type: "array" } },
},
endpoint: "https://api.example.com/calendar",
}),
});
const { data } = await response.json();import requests, os
response = requests.post(
f"{os.environ['BASE_URL']}/agents/tools",
headers={"Authorization": f"Bearer {os.environ['TOKEN']}"},
json={
"name": "Calendar Lookup",
"description": "Look up events from the user calendar",
"type": "api",
"schema": {
"input": {"date": {"type": "string", "format": "date"}},
"output": {"events": {"type": "array"}},
},
"endpoint": "https://api.example.com/calendar",
},
)
data = response.json()["data"]