스케줄러
Astreus 문서에서 스케줄러에 대해 알아보고, 에이전트 시스템을 구축하기 위한 설정 안내, API 패턴, 실용적인 예제를 확인하세요. 안정적인 Astreus 에이전트 시스템을 구축하는 데 필요한 설정 패턴, API, 실용적인 예제를 알아보세요.
최소한의 설정으로 사용하는 간단한 시간 기반 실행
Overview
Astreus 스케줄러는 직관적인 스케줄 문자열을 사용해 작업과 그래프에 대한 간단한 시간 기반 실행을 제공합니다. 복잡한 설정이 필요 없습니다. schedule 필드만 추가하면 끝입니다!
Basic Task Scheduling
간단한 문법으로 개별 작업을 예약하세요.
import { Agent } from '@astreus-ai/astreus';
const agent = await Agent.create({
name: 'SchedulerAgent',
model: 'gpt-4o'
});
// Create a scheduled task - scheduler starts automatically when needed
const scheduledTask = await agent.createTask({
prompt: 'Generate monthly report for December',
schedule: 'once@2024-12-25@09:00'
});
// Create a recurring task
const dailyTask = await agent.createTask({
prompt: 'Daily health check and status report',
schedule: 'daily@08:00'
});
// Execute the task - scheduler will handle the scheduling automatically
await agent.executeTask(scheduledTask.id);Schedule Configuration
간편한 설정을 위해 간단한 스케줄 문자열을 사용하세요.
// Supported schedule formats:
'daily@07:00' // Daily at 7 AM
'weekly@monday@09:00' // Weekly on Monday at 9 AM
'monthly@1@10:00' // Monthly on 1st day at 10 AM
'hourly' // Every hour (default time)
'@15:30' // Once today at 3:30 PM
'once@2024-12-25@10:00' // Once on specific date and time
// Delay-based schedules:
'after:5s' // Run after 5 seconds
'after:30m' // Run after 30 minutes
'after:2h' // Run after 2 hours
// Examples:
await agent.createTask({
prompt: 'Morning briefing',
schedule: 'daily@08:00'
});
await agent.createTask({
prompt: 'Weekly report',
schedule: 'weekly@friday@17:00'
});Graph Scheduling with Dependencies
지능적인 종속성 해석으로 그래프를 예약하세요.
import { Graph } from '@astreus-ai/astreus';
const graph = new Graph({
name: 'Morning Workflow',
defaultAgentId: agent.id
}, agent);
// Node A: Data collection at 6 AM
const nodeA = graph.addTaskNode({
name: 'Data Collection',
prompt: 'Collect overnight data from all sources',
schedule: 'once@2024-12-20@06:00'
});
// Node B: Processing (depends on A completing first)
const nodeB = graph.addTaskNode({
name: 'Data Processing',
prompt: 'Process collected data and generate insights',
schedule: 'once@2024-12-20@07:00',
dependsOn: ['Data Collection'] // Must wait for A
});
// Node C: Report generation at 8 AM
const nodeC = graph.addTaskNode({
name: 'Report Generation',
prompt: 'Generate morning executive report',
schedule: 'once@2024-12-20@08:00',
dependsOn: ['Data Processing']
});
// Execute - scheduler starts automatically for scheduled nodes
await graph.run();
// Result: A runs at 06:00, B waits and runs after A (~06:05), C runs at 08:00Recurring Patterns
정교한 반복 스케줄을 만드세요.
Daily Schedules
// Every day at 8 AM
{
type: 'recurring',
executeAt: new Date('2024-12-20T08:00:00Z'),
recurrence: {
pattern: 'daily',
interval: 1,
maxExecutions: 365 // Stop after 1 year
}
}
// Every 3 days
{
type: 'recurring',
executeAt: new Date('2024-12-20T08:00:00Z'),
recurrence: {
pattern: 'daily',
interval: 3
}
}Weekly Schedules
// Every Monday at 9 AM
{
type: 'recurring',
executeAt: new Date('2024-12-23T09:00:00Z'), // Monday
recurrence: {
pattern: 'weekly',
interval: 1,
daysOfWeek: [1] // Monday
}
}
// Every Monday and Friday
{
type: 'recurring',
executeAt: new Date('2024-12-23T09:00:00Z'),
recurrence: {
pattern: 'weekly',
interval: 1,
daysOfWeek: [1, 5] // Monday and Friday
}
}Monthly and Yearly
// 15th of every month
{
type: 'recurring',
executeAt: new Date('2024-12-15T10:00:00Z'),
recurrence: {
pattern: 'monthly',
interval: 1,
dayOfMonth: 15
}
}
// Every January 1st
{
type: 'recurring',
executeAt: new Date('2025-01-01T00:00:00Z'),
recurrence: {
pattern: 'yearly',
interval: 1,
monthOfYear: 1
}
}Dependency Resolution Logic
스케줄러는 스케줄과 종속성 간의 충돌을 지능적으로 해석합니다.
| Scenario | Behavior |
|---|---|
| 종속성보다 먼저 예약된 노드 | 종속성이 완료될 때까지 대기 |
| 종속성 이후에 예약된 노드 | 예약된 시간에 실행 |
| 여러 종속성 | 모든 종속성을 대기 |
| 순환 종속성 | 검증 중 오류 발생 |
| 예약된 노드와 즉시 실행 노드 혼합 | 원활하게 함께 동작 |
스케줄러는 종속성을 존중하고 필요에 맞게 확장되는 자동화된 시간 기반 AI 워크플로우를 구축하기 위한 견고한 기반을 제공합니다.
마지막 업데이트: 2026년 7월 6일
이 섹션에서
소개
실제 작업을 효과적으로 해결하는 자율 시스템을 구축하기 위한 오픈소스 AI 에이전트 프레임워크입니다. 안정적인 Astreus 에이전트 시스템을 구축하는 데 필요한 설정 패턴, API, 실용적인 예제를 알아보세요.
설치
npm, yarn, pnpm을 사용해 Astreus를 설치하고, 필요한 Node.js 버전을 확인한 다음 프레임워크로 AI 에이전트를 구축할 로컬 프로젝트를 준비합니다.
빠른 시작
Astreus 문서에서 빠른 시작에 대해 알아보고, 에이전트 시스템을 구축하기 위한 설정 안내, API 패턴, 실용적인 예제를 확인하세요. 안정적인 Astreus 에이전트 시스템을 구축하는 데 필요한 설정 패턴, API, 실용적인 예제를 알아보세요.
에이전트
Astreus 문서에서 에이전트에 대해 알아보고, 에이전트 시스템을 구축하기 위한 설정 안내, API 패턴, 실용적인 예제를 확인하세요. 안정적인 Astreus 에이전트 시스템을 구축하는 데 필요한 설정 패턴, API, 실용적인 예제를 알아보세요.