On this page

List timers

GET/agents/{id}/timers

Operation getAgentTimersAuthBearer token

Path parameters

NameTypeDescription
idrequiredstring

Loaded agent: its id, handle or name.

example: agent-1

Responses

StatusDescriptionBody
200Timers (expired ones kept as history)TimersResponse
agentIdrequiredstring

Agent id

timersrequiredarray<Timer>
13 fields of timers
idrequiredinteger
schedulerequiredobject | object | object
3 variants of schedule
Option 1object
2 fields of Option 1
moderequiredstring

Value once

atrequiredinteger
Option 2object
5 fields of Option 2
moderequiredstring

Value interval

every_msrequiredinteger
start_atinteger
end_atinteger
max_runsinteger
Option 3object
4 fields of Option 3
moderequiredstring

Value cron

cronrequiredstring
end_atinteger
max_runsinteger
next_wake_atrequiredinteger
payloadstring
scoperequiredarray<string>

One of system, agent

lambdastring
warmboolean
run_countrequiredinteger
created_atrequiredinteger
last_fired_atinteger
lockedboolean
loopstring
expiredboolean
Errors 401 · 403 · 404
401Missing or wrong bearer token (unauthorized)
403The 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
404Unknown agent (or the named resource: loop, task, file, …)

Error bodies use the error format.

Example

Request
curl "http://127.0.0.1:7385/agents/agent-1/timers" \
  -H "Authorization: Bearer $ADF_DAEMON_TOKEN"

Add a timer

POST/agents/{id}/timers

Operation addAgentTimerAuthBearer token

Same 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

NameTypeDescription
idrequiredstring

Loaded agent: its id, handle or name.

example: agent-1

Request bodyapplication/json · TimerMutationBody · required

FieldTypeDescription
moderequiredstring

One of once_at, once_delay, interval, cron

atinteger

once_at: epoch ms

delay_msinteger

once_delay

every_msinteger

interval

start_atinteger
end_atinteger
max_runsinteger
cronstring

cron

scopearray<string>

One of system, agent

lambdastring
warmboolean
payloadstring
lockedboolean
loopstring

Cognition loop the agent-scope wake targets. Create: absent = main. Update: moves the timer (main moves it back); absent keeps its loop.

Responses

StatusDescriptionBody
200CreatedTimerCreateResponse
agentIdrequiredstring

Agent id

successrequiredboolean

Value true

idrequiredinteger
Errors 400 · 401 · 403 · 404 · 500
400Invalid 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
401Missing or wrong bearer token (unauthorized)
403The 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
404Unknown agent (or the named resource: loop, task, file, …)
500Unexpected runtime failure

Error bodies use the error format.

Example

Request
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

PUT/agents/{id}/timers/{timerId}

Operation updateAgentTimerAuthBearer token

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

NameTypeDescription
idrequiredstring

Loaded agent: its id, handle or name.

example: agent-1

timerIdrequiredinteger

Timer id

example: 3

Request bodyapplication/json · TimerMutationBody · required

Fields as in TimerMutationBody above.

Responses

StatusDescriptionBody
200success is false when no such timerAgentSuccess
agentIdrequiredstring

Agent id

successrequiredboolean
Errors 400 · 401 · 403 · 404 · 500
400Invalid 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
401Missing or wrong bearer token (unauthorized)
403The 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
404Unknown agent (or the named resource: loop, task, file, …)
500Unexpected runtime failure

Error bodies use the error format.

Example

Request
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"
}'
Response 200
{
  "agentId": "Xk3v9QpLm2",
  "success": true
}

Delete a timer

DELETE/agents/{id}/timers/{timerId}

Operation deleteAgentTimerAuthBearer token

Path parameters

NameTypeDescription
idrequiredstring

Loaded agent: its id, handle or name.

example: agent-1

timerIdrequiredinteger

Timer id

example: 3

Responses

StatusDescriptionBody
200success is false when no such timerAgentSuccess
agentIdrequiredstring

Agent id

successrequiredboolean
Errors 400 · 401 · 403 · 404 · 500
400Invalid 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
401Missing or wrong bearer token (unauthorized)
403The 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
404Unknown agent (or the named resource: loop, task, file, …)
500Unexpected runtime failure

Error bodies use the error format.

Example

Request
curl -X DELETE "http://127.0.0.1:7385/agents/agent-1/timers/3" \
  -H "Authorization: Bearer $ADF_DAEMON_TOKEN"
Response 200
{
  "agentId": "Xk3v9QpLm2",
  "success": true
}