기능
Astreus 문서에서 기능에 대해 알아보고, 에이전트 시스템을 구축하기 위한 설정 안내, API 패턴, 실용적인 예제를 확인하세요. 안정적인 Astreus 에이전트 시스템을 구축하는 데 필요한 설정 패턴, API, 실용적인 예제를 알아보세요.
새 에이전트를 스캐폴딩할 때 포함할 수 있는 각 기능에 대한 상세 설명입니다.
메모리
에이전트에 지속적인 메모리를 활성화합니다. 에이전트는 효율적인 검색을 위해 벡터 검색을 사용하여 세션 간에 대화를 기억합니다.
const agent = await Agent.create({
name: 'my-agent',
model: 'gpt-4o',
memory: true,
});
await agent.ask("My name is John");
// Later, even in a new session:
await agent.ask("What's my name?"); // "Your name is John"사용 사례:
- 사용자 선호도를 기억하는 개인 비서
- 대화 기록이 있는 고객 지원 봇
- 컨텍스트 유지가 필요한 장시간 실행되는 에이전트
지식 (RAG)
문서 검색 기능을 추가합니다. PDF, 텍스트 파일 및 기타 문서를 검색 가능한 지식 베이스로 수집합니다.
const agent = await Agent.create({
name: 'my-agent',
model: 'gpt-4o',
knowledge: true,
});
// Add documents to knowledge base
await agent.addKnowledgeFromFile('./docs/guide.pdf', { category: 'docs' });
await agent.addKnowledgeFromFile('./docs/api.md', { category: 'api' });
// Agent answers from documents
await agent.ask("What does the guide say about authentication?");사용 사례:
- 문서 Q&A 봇
- 리서치 어시스턴트
- 지식 관리 시스템
요구 사항: pgvector 확장이 포함된 PostgreSQL
그래프 워크플로우
DAG 기반 작업 오케스트레이션으로 복잡한 다단계 워크플로우를 생성합니다. 작업 간 종속성을 정의하고 가능한 경우 병렬로 실행합니다.
import { Agent, Graph } from '@astreus-ai/astreus';
const agent = await Agent.create({ name: 'my-agent', model: 'gpt-4o' });
const graph = new Graph({ name: 'research-workflow' }, agent);
// Define workflow nodes
const researchNode = graph.addTaskNode({
prompt: 'Research the topic thoroughly'
});
const analyzeNode = graph.addTaskNode({
prompt: 'Analyze the research findings',
dependsOn: [researchNode]
});
const writeNode = graph.addTaskNode({
prompt: 'Write a comprehensive report',
dependsOn: [analyzeNode]
});
// Execute the workflow
const result = await graph.run();
console.log(result.results);사용 사례:
- 다단계 콘텐츠 생성
- 데이터 처리 파이프라인
- 복잡한 의사 결정 워크플로우
서브 에이전트
복잡한 작업을 위해 여러 전문 에이전트를 조율합니다. 각 서브 에이전트는 고유한 구성과 전문성을 가질 수 있습니다.
// Create specialized agents
const researcher = await Agent.create({
name: 'researcher',
model: 'gpt-4o',
systemPrompt: 'You are a research specialist.'
});
const writer = await Agent.create({
name: 'writer',
model: 'gpt-4o',
systemPrompt: 'You are a professional writer.'
});
// Main agent coordinates sub-agents
const agent = await Agent.create({ name: 'coordinator', model: 'gpt-4o' });
const result = await agent.executeWithSubAgents(
'Research and write an article about quantum computing',
[researcher, writer]
);사용 사례:
- 콘텐츠 제작 파이프라인
- 여러 도메인을 다루는 전문가 시스템
- 병렬 작업 실행
커스텀 플러그인
커스텀 도구로 에이전트를 확장합니다. 각 도구에 대한 파라미터, 설명, 핸들러를 정의합니다.
const weatherPlugin = {
name: 'weather-plugin',
version: '1.0.0',
description: 'Get weather information',
tools: [{
name: 'get_weather',
description: 'Get current weather for a location',
parameters: {
location: {
type: 'string',
description: 'City name',
required: true
}
},
handler: async ({ location }) => {
const response = await fetch(`https://api.weather.com/${location}`);
const data = await response.json();
return { success: true, data };
}
}]
};
const agent = await Agent.create({ name: 'my-agent', model: 'gpt-4o' });
await agent.registerPlugin(weatherPlugin);
// Agent can now use the weather tool
await agent.ask("What's the weather in Tokyo?");사용 사례:
- API 연동
- 데이터베이스 작업
- 커스텀 비즈니스 로직
MCP 연동
표준화된 도구 연동을 위한 Model Context Protocol 지원입니다. MCP 호환 서비스 및 도구에 연결합니다.
const agent = await Agent.create({
name: 'my-agent',
model: 'gpt-4o',
mcp: {
servers: [
{ name: 'filesystem', command: 'mcp-server-filesystem' },
{ name: 'github', command: 'mcp-server-github' }
]
}
});사용 사례:
- 파일 시스템 작업
- GitHub 연동
- 표준화된 도구 생태계
기능 조합
기능들은 원활하게 함께 작동합니다.
const agent = await Agent.create({
name: 'advanced-agent',
model: 'gpt-4o',
memory: true, // Remember conversations
knowledge: true, // Access documents
mcp: { // Use MCP tools
servers: [
{ name: 'filesystem', command: 'mcp-server-filesystem' }
]
}
});
// Register custom plugins
await agent.registerPlugin(myCustomPlugin);
// Use with graph workflows
const graph = new Graph({ name: 'workflow' }, agent);마지막 업데이트: 2026년 7월 6일
이 섹션에서