Temel Alt Ajanlar
Karmaşık görev dağıtımı için birden fazla yapay zeka ajanı oluşturun ve koordine edin.
Hızlı Başlangıç#
Eksiksiz Örneği Klonlayın#
Başlamanın en kolay yolu, eksiksiz örnek repository'sini klonlamaktır:
git clone https://github.com/astreus-ai/examples
cd examples/sub-agents-basic
npm installYa da Sadece Paketi Yükleyin#
Sıfırdan oluşturmayı tercih ediyorsanız:
npm install @astreus-ai/astreusOrtam Kurulumu#
# .env
OPENAI_API_KEY=sk-your-openai-api-key-here
DB_URL=sqlite://./astreus.dbBasit Alt Ajan Kurulumu#
import { Agent } from '@astreus-ai/astreus';
// Create specialized sub-agents
const researcher = await Agent.create({
name: 'Researcher',
model: 'gpt-6-astra',
systemPrompt: 'You are an expert researcher who gathers comprehensive information.'
});
const writer = await Agent.create({
name: 'Writer',
model: 'gpt-6-astra',
systemPrompt: 'You are a skilled writer who creates clear, engaging content.'
});
// Create main coordinator agent
const mainAgent = await Agent.create({
name: 'Coordinator',
model: 'gpt-6-astra',
systemPrompt: 'You coordinate tasks between specialized agents.',
subAgents: [researcher, writer]
});
// Use auto delegation
const result = await mainAgent.ask(
'Research artificial intelligence trends and write a summary',
{
useSubAgents: true,
delegation: 'auto'
}
);
console.log(result);Örneği Çalıştırma#
Repository'yi klonladıysanız:
npm run devSıfırdan oluşturduysanız, yukarıdaki kodla bir index.ts dosyası oluşturun ve şunu çalıştırın:
npx tsx index.tsRepository#
Eksiksiz örnek GitHub üzerinde mevcuttur: examples/sub-agents-basic