Hızlı Başlangıç
2 dakikadan kısa sürede Astreus ile ilk AI ajanınızı oluşturun
Görevleri yürütebilen ve akıllıca yanıt verebilen basit bir ajan oluşturalım.
Devam etmeden önce Astreus'un kurulu olduğundan emin olun. Henüz kurmadıysanız kurulum rehberini takip edin.
İlk ajanınızı oluşturun#
Ortam Dosyası Oluşturun#
Proje kök dizininizde bir .env dosyası oluşturun ve OpenAI API anahtarınızı ekleyin:
touch .envAPI anahtarınızı .env dosyasına ekleyin:
OPENAI_API_KEY=sk-your-openai-api-key-hereİlk Ajanınızı Oluşturun#
Bellek ve sistem promptuyla bir ajan oluşturun:
import { Agent } from '@astreus-ai/astreus';
// Create agent
const agent = await Agent.create({
name: 'ResearchAgent',
model: 'gpt-6-astra',
memory: true,
systemPrompt: 'You are an expert research assistant.'
});Görev Oluşturun ve Çalıştırın#
Bir görev oluşturun ve ajanınızla çalıştırın:
import { Agent } from '@astreus-ai/astreus';
// Create agent
const agent = await Agent.create({
name: 'ResearchAgent',
model: 'gpt-6-astra',
memory: true,
systemPrompt: 'You are an expert research assistant.'
});
// Create a task
const task = await agent.createTask({
prompt: "Research latest news in Anthropic and OpenAI"
});
// Execute the task
const result = await agent.executeTask(task.id);
console.log(result.response);Graph İş Akışı Oluşturun#
Birden fazla görev içeren bir iş akışı grafiği oluşturun:
import { Agent, Graph } from '@astreus-ai/astreus';
// Create agent
const agent = await Agent.create({
name: 'ResearchAgent',
model: 'gpt-6-astra',
memory: true,
systemPrompt: 'You are an expert research assistant.'
});
// Create a graph for complex workflows
const graph = new Graph({
name: 'Research Pipeline',
defaultAgentId: agent.id
});
// Add task nodes
const researchNode = graph.addTaskNode({
prompt: 'Research the latest AI developments'
});
const analysisNode = graph.addTaskNode({
prompt: 'Analyze the research findings',
dependencies: [researchNode]
});
const summaryNode = graph.addTaskNode({
prompt: 'Create a summary report',
dependencies: [analysisNode]
});
// Run the graph
const graphResult = await graph.run();
console.log(graphResult.results[summaryNode]);Tebrikler! Astreus ile ilk AI ajanınızı oluşturdunuz.