Ajan Kalıcılığı
Yeniden kullanılabilirlik için ajanları veritabanından kaydedin ve yükleyin.
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/agent-persistence
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.dbAjan Kalıcılığı#
import { Agent } from '@astreus-ai/astreus';
// Create and save an agent
const agent = await Agent.create({
name: 'ProjectAssistant',
model: 'gpt-6-astra',
memory: true,
systemPrompt: 'You are a project management assistant.'
});
// Use the agent
await agent.ask("Remember that our project deadline is March 15th");
// Later, load the same agent by name
const loadedAgent = await Agent.findByName('ProjectAssistant');
const response = await loadedAgent?.ask("What is our project deadline?");
console.log(response); // Should remember March 15thÖrneği Çalıştırma#
Repository'yi klonladıysanız:
npm run devRepository#
Eksiksiz örnek GitHub üzerinde mevcuttur: examples/agent-persistence