Becerileri Yönetme
Bu öğreticide bir beceri oluşturacak, sürümlenmiş bir yayın yayınlayacak ve bunu bir ajana ekleyeceksiniz. Beceriler, bir ajanın neler yapabileceğini tanımlayan yeniden kullanılabilir yeteneklerdir.
Ön Koşullar
- Geçerli bir erişim token'ına sahip bir Chainabit hesabı
- Terminalinizde kullanılabilir durumda olan
curl - Mevcut bir ajan (bkz. Yapay Zeka Ajanı Oluşturma)
Ortam değişkenlerinizi ayarlayın:
bash
export TOKEN="your-access-token"Beceri Yapısı
Bir beceri birden fazla sürüme sahip olabilir. Her ajan belirli bir sürümü referans alır, böylece güncellemeleri kademeli olarak dağıtabilirsiniz.
Adım 1: Beceri Oluşturma
Yeni bir beceriyi meta verileriyle birlikte tanımlayın:
bash
curl -s -X POST "https://api.chainabit.com/api/v1/agents/skills" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Activity Summarizer",
"description": "Generates natural-language summaries from activity completion data.",
"category": "analytics"
}'javascript
const res = await fetch(`https://api.chainabit.com/api/v1/agents/skills`, {
method: 'POST',
headers: {
Authorization: `Bearer ${TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Activity Summarizer',
description:
'Generates natural-language summaries from activity completion data.',
category: 'analytics',
}),
});
const data = await res.json();
console.log(data);python
import requests
res = requests.post(
f"{BASE}/agents/skills",
headers={
"Authorization": f"Bearer {TOKEN}",
"Content-Type": "application/json",
},
json={
"name": "Activity Summarizer",
"description": "Generates natural-language summaries from activity completion data.",
"category": "analytics",
},
)
print(res.json())Yanıt:
json
{
"data": {
"id": "skill_01HQA...",
"name": "Activity Summarizer",
"description": "Generates natural-language summaries from activity completion data.",
"category": "analytics",
"createdAt": "2026-03-17T10:00:00.000Z"
}
}Beceri ID'sini kaydedin:
bash
export SKILL_ID="skill_01HQA..."Adım 2: Beceri Sürümü Oluşturma
Becerinin uygulama detaylarıyla birlikte sürümlenmiş bir yayın oluşturun:
bash
curl -s -X POST "https://api.chainabit.com/api/v1/agents/skill-versions" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"skillId": "'"$SKILL_ID"'",
"version": "1.0.0",
"instructions": "Given a list of bit completions, produce a summary paragraph highlighting streaks, missed days, and overall progress.",
"inputSchema": {
"type": "object",
"properties": {
"bitIds": { "type": "array", "items": { "type": "string" } },
"dateRange": { "type": "string" }
},
"required": ["bitIds"]
},
"status": "published"
}'javascript
const res = await fetch(`https://api.chainabit.com/api/v1/agents/skill-versions`, {
method: 'POST',
headers: {
Authorization: `Bearer ${TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
skillId: SKILL_ID,
version: '1.0.0',
instructions:
'Given a list of bit completions, produce a summary paragraph highlighting streaks, missed days, and overall progress.',
inputSchema: {
type: 'object',
properties: {
bitIds: { type: 'array', items: { type: 'string' } },
dateRange: { type: 'string' },
},
required: ['bitIds'],
},
status: 'published',
}),
});
const data = await res.json();
console.log(data);python
res = requests.post(
f"{BASE}/agents/skill-versions",
headers={
"Authorization": f"Bearer {TOKEN}",
"Content-Type": "application/json",
},
json={
"skillId": SKILL_ID,
"version": "1.0.0",
"instructions": "Given a list of bit completions, produce a summary paragraph highlighting streaks, missed days, and overall progress.",
"inputSchema": {
"type": "object",
"properties": {
"bitIds": {"type": "array", "items": {"type": "string"}},
"dateRange": {"type": "string"},
},
"required": ["bitIds"],
},
"status": "published",
},
)
print(res.json())Yanıt:
json
{
"data": {
"id": "sv_01HQB...",
"skillId": "skill_01HQA...",
"version": "1.0.0",
"status": "published",
"createdAt": "2026-03-17T10:01:00.000Z"
}
}Beceri sürüm ID'sini kaydedin:
bash
export SKILL_VERSION_ID="sv_01HQB..."Adım 3: Beceriyi Bir Ajana Ekleme
Yayınlanan beceri sürümünü mevcut bir ajana bağlayın:
bash
curl -s -X POST "https://api.chainabit.com/api/v1/agents/definitions/$AGENT_ID/skills" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"skillVersionId": "'"$SKILL_VERSION_ID"'"
}'javascript
const res = await fetch(
`https://api.chainabit.com/api/v1/agents/definitions/${AGENT_ID}/skills`,
{
method: 'POST',
headers: {
Authorization: `Bearer ${TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
skillVersionId: SKILL_VERSION_ID,
}),
},
);
const data = await res.json();
console.log(data);python
res = requests.post(
f"{BASE}/agents/definitions/{AGENT_ID}/skills",
headers={
"Authorization": f"Bearer {TOKEN}",
"Content-Type": "application/json",
},
json={"skillVersionId": SKILL_VERSION_ID},
)
print(res.json())Yanıt:
json
{
"data": {
"agentId": "agent_01HQA...",
"skillVersionId": "sv_01HQB...",
"attachedAt": "2026-03-17T10:02:00.000Z"
}
}Adım 4: Ajandaki Becerileri Listeleme
Hangi becerilerin eklendiğini doğrulayın:
bash
curl -s "https://api.chainabit.com/api/v1/agents/definitions/$AGENT_ID/skills" \
-H "Authorization: Bearer $TOKEN"javascript
const res = await fetch(
`https://api.chainabit.com/api/v1/agents/definitions/${AGENT_ID}/skills`,
{
headers: { Authorization: `Bearer ${TOKEN}` },
},
);
const data = await res.json();
console.log(data);python
res = requests.get(
f"{BASE}/agents/definitions/{AGENT_ID}/skills",
headers={"Authorization": f"Bearer {TOKEN}"},
)
print(res.json())Özet
Bu öğreticide şunları yaptınız:
- Meta verilerle bir beceri tanımı oluşturdunuz
- Talimatlar ve bir giriş şemasıyla birlikte bir beceri sürümü yayınladınız
- Beceriyi bir ajana eklediniz
- Ajandaki becerileri listediniz
Sonraki Adımlar
- Henüz bir ajan oluşturmadıysanız Yapay Zeka Ajanı Oluşturma
- Becerileri kullanan zincirleri (iş akışlarını) çalıştırmak için Zincir Tetikleyicileri (EN)
- Tam endpoint dokümantasyonu için Ajanlar API Referansı