Cron & Scheduler
Pianifica chiamate API ricorrenti — cron job che si attivano secondo una pianificazione, perfetti per sync periodici e promemoria.
Cron & Scheduler
La Cron API permette di pianificare chiamate HTTP ricorrenti agli endpoint di Synapse (o a endpoint HTTPS esterni). Perfetta per sync periodici, promemoria e attività di manutenzione.
Endpoint
POST /cron
Crea un'attività pianificata.
curl -X POST https://synapse.schaefer.zone/cron \
-H "Authorization: Bearer YOUR_MIND_KEY" \
-H "Content-Type: application/json" \
-d '{
"schedule": "0 * * * *",
"endpoint": "https://synapse.schaefer.zone/memory/recall",
"method": "GET",
"headers": {"Authorization": "Bearer YOUR_MIND_KEY"}
}'Risposta:
{
"id": "cron_001",
"schedule": "0 * * * *",
"endpoint": "https://synapse.schaefer.zone/memory/recall",
"method": "GET",
"enabled": true,
"next_run": "2026-06-27T13:00:00Z",
"created_at": "2026-06-27T..."
}GET /cron
Elenca tutte le attività pianificate.
curl -H "Authorization: Bearer YOUR_MIND_KEY" \
https://synapse.schaefer.zone/cronDELETE /cron/:id
Elimina un'attività pianificata.
curl -X DELETE -H "Authorization: Bearer YOUR_MIND_KEY" \
https://synapse.schaefer.zone/cron/cron_001PUT /cron/:id/toggle
Abilita o disabilita un'attività senza eliminarla.
curl -X PUT -H "Authorization: Bearer YOUR_MIND_KEY" \
https://synapse.schaefer.zone/cron/cron_001/toggleSintassi della pianificazione
Cron standard (5 campi)
┌───── minute (0-59)
│ ┌───── hour (0-23)
│ │ ┌───── day of month (1-31)
│ │ │ ┌───── month (1-12)
│ │ │ │ ┌───── day of week (0-6, 0=Sunday)
│ │ │ │ │
* * * * *Esempi:
| Pianificazione | Significato |
|---|---|
0 * * * * |
Ogni ora |
*/15 * * * * |
Ogni 15 minuti |
0 9 * * 1-5 |
Giorni feriali alle 9:00 |
0 0 * * 0 |
Ogni domenica a mezzanotte |
0 0 1 * * |
Il primo di ogni mese a mezzanotte |
Intervallo intero (secondi)
Per intervalli semplici, passi un intero:
{ "schedule": "300" } // Every 5 minutesRestrizioni sugli endpoint
Gli endpoint devono essere URL `http://` o `https://` che puntano a:
Questo previene attacchi SSRF in cui una mente compromessa potrebbe pianificare richieste a servizi interni.
Modelli comuni
Richiamo memoria orario (per agenti LLM)
curl -X POST .../cron -d '{
"schedule": "0 * * * *",
"endpoint": "https://synapse.schaefer.zone/memory/recall",
"method": "GET",
"headers": {"Authorization": "Bearer YOUR_MIND_KEY"}
}'Backup giornaliero
curl -X POST .../cron -d '{
"schedule": "0 2 * * *",
"endpoint": "https://synapse.schaefer.zone/memory/mind-export",
"method": "GET",
"headers": {"Authorization": "Bearer YOUR_MIND_KEY"}
}'Polling chat periodico (ogni 5 minuti)
curl -X POST .../cron -d '{
"schedule": "300",
"endpoint": "https://synapse.schaefer.zone/chat/poll",
"method": "GET",
"headers": {"Authorization": "Bearer YOUR_MIND_KEY"}
}'Attivazione report settimanale
curl -X POST .../cron -d '{
"schedule": "0 9 * * 1",
"endpoint": "https://my-app.com/weekly-report",
"method": "POST",
"body": "{\"mind_id\": \"m_xyz789\"}",
"headers": {"Content-Type": "application/json", "X-API-Key": "my-secret"}
}'