# SympoziumSchedule #sympozium #crd #schedule ## Definicja `SympoziumSchedule` definiuje **recurring tasks** dla SympoziumInstance - analogicznie do CronJob, ale tworzy AgentRun zamiast Pod. **Plik:** `api/v1alpha1/sympoziumschedule_types.go` ## Spec ```yaml apiVersion: sympozium.ai/v1alpha1 kind: SympoziumSchedule metadata: name: my-agent-health-check spec: instanceRef: my-agent schedule: "*/30 * * * *" # Co 30 minut task: "Run comprehensive health check" type: heartbeat|scheduled|sweep suspend: false concurrencyPolicy: Forbid|Allow|Replace includeMemory: true # Inject MEMORY.md do kontekstu ``` ## Typy scheduli | Typ | Opis | Typowy interwał | |-----|------|-----------------| | `heartbeat` | Regularne sprawdzanie stanu | 5-30 minut | | `scheduled` | Zaplanowane zadania | Godzinowo/dziennie | | `sweep` | Przeglądy i cleanup | Dziennie/tygodniowo | ## Concurrency Policy | Polityka | Zachowanie | |----------|------------| | `Forbid` | Nie twórz nowego runu jeśli poprzedni jeszcze działa | | `Allow` | Pozwól na równoległe uruchomienia | | `Replace` | Anuluj poprzedni run i utwórz nowy | ## Self-scheduling Agenty mogą **same zarządzać swoimi schedulami** przez narzędzie `schedule_task`: ``` Agent → /ipc/schedules/create-schedule.json → IPC Bridge → NATS: schedule.upsert → Schedule Router → tworzy/aktualizuje SympoziumSchedule CRD ``` Operacje: create, update, suspend, resume, delete. ## Status ```yaml status: phase: Active|Suspended|Error lastRunTime: "2024-01-01T12:00:00Z" nextRunTime: "2024-01-01T12:30:00Z" lastRunName: my-agent-health-check-run-42 totalRuns: 200 ``` ## Reconciliation `SympoziumScheduleReconciler`: 1. Oblicza `nextRunTime` z cron expression 2. Kiedy `now >= nextRunTime`: - Sprawdza concurrency policy - Tworzy AgentRun CR z task + opcjonalnie memory - Aktualizuje `lastRunTime` i `lastRunName` --- Powiązane: [[Scheduled Tasks - heartbeaty i swepy]] | [[SympoziumInstance]] | [[AgentRun]]