Timers
An agent's scheduled wake-ups.
On this page
List timers
/agents/{id}/timersPath parameters
| Name | Type | Description |
|---|---|---|
idrequired | string | Loaded agent: its id, handle or name. |
Responses
| Status | Description | Body | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 200 | Timers (expired ones kept as history) | TimersResponse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Option 2object | 5 fields of | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
moderequired | string | |
every_msrequired | integer | |
start_at | integer | |
end_at | integer | |
max_runs | integer |
Option 34 fields of Option 3
moderequired | string | |
cronrequired | string | |
end_at | integer | |
max_runs | integer |
next_wake_atrequiredpayloadscoperequiredlambdawarmrun_countrequiredcreated_atrequiredlast_fired_atlockedloopexpiredErrors 401 · 403 · 404
| 401 | Missing or wrong bearer token (unauthorized) | |
| 403 | The request guard refused it: Host header not allowed (host_not_allowed, DNS-rebinding protection) or a browser cross-site request (cross_origin)host_not_allowedcross_origin | |
| 404 | Unknown agent (or the named resource: loop, task, file, …) |
Error bodies use the error format.
Example
curl "http://127.0.0.1:7385/agents/agent-1/timers" \
-H "Authorization: Bearer $ADF_DAEMON_TOKEN"Add a timer
/agents/{id}/timersSame body as Studio's timer creation. loop names the cognition loop an agent-scope wake dispatches to (absent = main; unknown = 404): this is how an inner loop runs on a schedule. A system-scope-only timer carries no loop.
Path parameters
| Name | Type | Description |
|---|---|---|
idrequired | string | Loaded agent: its id, handle or name. |
Request bodyapplication/json · TimerMutationBody · required
| Field | Type | Description |
|---|---|---|
moderequired | string | |
at | integer | once_at: epoch ms |
delay_ms | integer | once_delay |
every_ms | integer | interval |
start_at | integer | |
end_at | integer | |
max_runs | integer | |
cron | string | cron |
scope | array<string> | |
lambda | string | |
warm | boolean | |
payload | string | |
locked | boolean | |
loop | string | Cognition loop the agent-scope wake targets. Create: absent = main. Update: moves the timer ( |
Responses
| Status | Description | Body | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 200 | Created | TimerCreateResponse | |||||||||
| |||||||||||
Errors 400 · 401 · 403 · 404 · 500
| 400 | Invalid request: missing or malformed field, query parameter or body. A body Fastify cannot parse gets Fastify's own shape (statusCode, code, error, message).bad_requestFST_ERR_CTP_EMPTY_JSON_BODY | |
| 401 | Missing or wrong bearer token (unauthorized) | |
| 403 | The request guard refused it: Host header not allowed (host_not_allowed, DNS-rebinding protection) or a browser cross-site request (cross_origin)host_not_allowedcross_origin | |
| 404 | Unknown agent (or the named resource: loop, task, file, …) | |
| 500 | Unexpected runtime failure |
Error bodies use the error format.
Example
curl -X POST "http://127.0.0.1:7385/agents/agent-1/timers" \
-H "Authorization: Bearer $ADF_DAEMON_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mode": "interval",
"every_ms": 3600000,
"scope": [
"agent"
],
"payload": "hourly check-in"
}'Replace a timer's schedule and target
/agents/{id}/timers/{timerId}Same body as creation. With loop the timer moves to that loop in place (same id; "main" moves it back; unknown loop 404); without loop it keeps its loop.
Path parameters
| Name | Type | Description |
|---|---|---|
idrequired | string | Loaded agent: its id, handle or name. |
timerIdrequired | integer | Timer id |
Request bodyapplication/json · TimerMutationBody · required
Fields as in TimerMutationBody above.
Responses
| Status | Description | Body | ||||||
|---|---|---|---|---|---|---|---|---|
| 200 | success is false when no such timer | AgentSuccess | ||||||
| ||||||||
Errors 400 · 401 · 403 · 404 · 500
| 400 | Invalid request: missing or malformed field, query parameter or body. A body Fastify cannot parse gets Fastify's own shape (statusCode, code, error, message).bad_requestFST_ERR_CTP_EMPTY_JSON_BODY | |
| 401 | Missing or wrong bearer token (unauthorized) | |
| 403 | The request guard refused it: Host header not allowed (host_not_allowed, DNS-rebinding protection) or a browser cross-site request (cross_origin)host_not_allowedcross_origin | |
| 404 | Unknown agent (or the named resource: loop, task, file, …) | |
| 500 | Unexpected runtime failure |
Error bodies use the error format.
Example
curl -X PUT "http://127.0.0.1:7385/agents/agent-1/timers/3" \
-H "Authorization: Bearer $ADF_DAEMON_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mode": "interval",
"every_ms": 3600000,
"scope": [
"agent"
],
"payload": "hourly check-in"
}'{
"agentId": "Xk3v9QpLm2",
"success": true
}Delete a timer
/agents/{id}/timers/{timerId}Path parameters
| Name | Type | Description |
|---|---|---|
idrequired | string | Loaded agent: its id, handle or name. |
timerIdrequired | integer | Timer id |
Responses
| Status | Description | Body | ||||||
|---|---|---|---|---|---|---|---|---|
| 200 | success is false when no such timer | AgentSuccess | ||||||
| ||||||||
Errors 400 · 401 · 403 · 404 · 500
| 400 | Invalid request: missing or malformed field, query parameter or body. A body Fastify cannot parse gets Fastify's own shape (statusCode, code, error, message).bad_requestFST_ERR_CTP_EMPTY_JSON_BODY | |
| 401 | Missing or wrong bearer token (unauthorized) | |
| 403 | The request guard refused it: Host header not allowed (host_not_allowed, DNS-rebinding protection) or a browser cross-site request (cross_origin)host_not_allowedcross_origin | |
| 404 | Unknown agent (or the named resource: loop, task, file, …) | |
| 500 | Unexpected runtime failure |
Error bodies use the error format.
Example
curl -X DELETE "http://127.0.0.1:7385/agents/agent-1/timers/3" \
-H "Authorization: Bearer $ADF_DAEMON_TOKEN"{
"agentId": "Xk3v9QpLm2",
"success": true
}