Skip to content
Rigel docs
Open Rigel

Change a routine

agent.routine.update

POST/api/v1/households/{household_id}/commands/agent.routine.update

  • Command
  • Rigel runs it
  • Applies offline

Changes only the fields given: the title, the task, the app, who it is for, or when it repeats. Changing when it repeats works out the next run again from now; a paused routine stays paused. Fails with routine_not_found, person_not_found, or time_in_past for a once-only time that has passed. Returns the routine's ID and when it runs next (null if paused or finished).

Parameters#

Change a routine: parameters
FieldDescription
household_idpathstringrequired

The household's ID.

Idempotency-Keyheaderstringoptional

The command's ID. Reuse it when retrying the same command.

Request body#

JSON, as application/json.

Change a routine: request body fields
FieldDescription
routine_idstringrequired

A agent routine ID, such as rtn_01JC0000000000000000000000.

titlestringoptional

What the routine does in plain words for the list in settings, 1–120 characters, such as "Suggest a new recipe on Wednesdays".

1 to 120 characters
taskstringoptional

The instructions Rigel follows each time, up to 4000 characters, written to be read with nobody around: what to check, when to do something, and what to leave alone.

1 to 4,000 characters
appone of: meals, recipes, shopping, inventory, calendar, email, tasks, documents, chat, maintenance, null or nulloptional

The app whose guide Rigel reads; null for none.

for_person_idstringoptional

Whose authority it runs with and who it is for.

repeatone of 4 shapesoptional

How often it runs: daily at a time, weekly on some days, monthly on a day (1–28), or once on a date. Example: { "kind": "weekly", "days": ["wed"], "time": "09:00" }.

Shape 1
repeat.kindone of: dailyrequiredNo description.
repeat.timestringrequired

The time of day in the household's time zone, 24-hour "HH:MM", such as "09:00".

pattern ^([01]\d|2[0-3]):[0-5]\d$
Shape 2, with days
repeat.kindone of: weeklyrequiredNo description.
repeat.daysarray, each one of: mon, tue, wed, thu, fri, sat, sunrequired

The days of the week: "mon", "tue", "wed", "thu", "fri", "sat", "sun".

1 to 7 items
repeat.timestringrequired

The time of day in the household's time zone, 24-hour "HH:MM", such as "09:00".

pattern ^([01]\d|2[0-3]):[0-5]\d$
Shape 3, with day
repeat.kindone of: monthlyrequiredNo description.
repeat.dayintegerrequired

The day of the month, 1 to 28, so every month has it.

1 to 28
repeat.timestringrequired

The time of day in the household's time zone, 24-hour "HH:MM", such as "09:00".

pattern ^([01]\d|2[0-3]):[0-5]\d$
Shape 4, with date
repeat.kindone of: oncerequiredNo description.
repeat.datestringrequired

A calendar date in the household's time zone, YYYY-MM-DD.

pattern ^\d{4}-\d{2}-\d{2}$
repeat.timestringrequired

The time of day in the household's time zone, 24-hour "HH:MM", such as "09:00".

pattern ^([01]\d|2[0-3]):[0-5]\d$

Response#

200 The command was applied.

Change a routine: response fields
FieldDescription
resultobjectrequired

What the command returned, such as the IDs it created.

result.routine_idstringrequired

A agent routine ID, such as rtn_01JC0000000000000000000000.

result.next_run_atinteger or nullrequired

When it runs next, UTC milliseconds, or null.

versionintegerrequired

The household version after the command.

Errors#

Every error has the same envelope: error.code, error.message, error.details, error.recovery and error.request_id.

Change a routine: errors
StatusCodeWhen
400validation_failedA field is missing, misspelled or out of range. details.fields lists each problem.
401unauthenticatedThe request has no valid session.
404person_not_foundA person who isn't in the household.
404routine_not_foundA routine that isn't there.
404not_foundThe household doesn't exist, or you aren't a member of it.
409time_in_pastA once-only time that has passed.
409idempotency_key_reusedThe Idempotency-Key was already used for a different command.

Examples#

These are real. Each scenario is one of the command's test cases, run on a household when this site was built, and the response is what the API returned.

Changing the words schedules nothing

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "routine_id": "rtn_01JC00000000000000000000R1",
  "title": "Suggest something new on Wednesdays"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    routine_id: "rtn_01JC00000000000000000000R1",
    title: "Suggest something new on Wednesdays",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "routine_id": "rtn_01JC00000000000000000000R1",
  "title": "Suggest something new on Wednesdays"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R063VEEQ94SBMDZ9C9

{
  "result": {
    "routine_id": "rtn_01JC00000000000000000000R1",
    "next_run_at": 1762956000000
  },
  "version": 1
}

Changing when it repeats works out the next run again

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000BBBBBBBBBBBBBBBB' \
  -d '{
  "routine_id": "rtn_01JC00000000000000000000R1",
  "repeat": {
    "kind": "daily",
    "time": "17:00"
  },
  "app": null
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000BBBBBBBBBBBBBBBB",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    routine_id: "rtn_01JC00000000000000000000R1",
    repeat: {
      kind: "daily",
      time: "17:00",
    },
    app: null,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000BBBBBBBBBBBBBBBB

{
  "routine_id": "rtn_01JC00000000000000000000R1",
  "repeat": {
    "kind": "daily",
    "time": "17:00"
  },
  "app": null
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0MVGHYW387WZ2AB2T

{
  "result": {
    "routine_id": "rtn_01JC00000000000000000000R1",
    "next_run_at": 1762466400000
  },
  "version": 1
}

A paused routine stays paused when its repeat changes

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000CCCCCCCCCCCCCCCC' \
  -d '{
  "routine_id": "rtn_01JC00000000000000000000R1",
  "repeat": {
    "kind": "daily",
    "time": "17:00"
  }
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000CCCCCCCCCCCCCCCC",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    routine_id: "rtn_01JC00000000000000000000R1",
    repeat: {
      kind: "daily",
      time: "17:00",
    },
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000CCCCCCCCCCCCCCCC

{
  "routine_id": "rtn_01JC00000000000000000000R1",
  "repeat": {
    "kind": "daily",
    "time": "17:00"
  }
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0TJFCS40RN47KV7CQ

{
  "result": {
    "routine_id": "rtn_01JC00000000000000000000R1",
    "next_run_at": null
  },
  "version": 1
}

A new person

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000DDDDDDDDDDDDDDDD' \
  -d '{
  "routine_id": "rtn_01JC00000000000000000000R1",
  "for_person_id": "per_01JC000000000000000000000B"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000DDDDDDDDDDDDDDDD",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    routine_id: "rtn_01JC00000000000000000000R1",
    for_person_id: "per_01JC000000000000000000000B",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000DDDDDDDDDDDDDDDD

{
  "routine_id": "rtn_01JC00000000000000000000R1",
  "for_person_id": "per_01JC000000000000000000000B"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0ZZ894PE34ZC1N325

{
  "result": {
    "routine_id": "rtn_01JC00000000000000000000R1",
    "next_run_at": 1762956000000
  },
  "version": 1
}

A once-only time that has passed

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000EEEEEEEEEEEEEEEE' \
  -d '{
  "routine_id": "rtn_01JC00000000000000000000R1",
  "repeat": {
    "kind": "once",
    "date": "2025-01-01",
    "time": "08:00"
  }
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000EEEEEEEEEEEEEEEE",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    routine_id: "rtn_01JC00000000000000000000R1",
    repeat: {
      kind: "once",
      date: "2025-01-01",
      time: "08:00",
    },
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000EEEEEEEEEEEEEEEE

{
  "routine_id": "rtn_01JC00000000000000000000R1",
  "repeat": {
    "kind": "once",
    "date": "2025-01-01",
    "time": "08:00"
  }
}
Response, 409
HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0XDHDAV52SAFJCKZ4

{
  "error": {
    "code": "time_in_past",
    "message": "That time has already passed. No changes were applied.",
    "details": {},
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R0XDHDAV52SAFJCKZ4"
  }
}

A person who isn't in the household

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000FFFFFFFFFFFFFFFF' \
  -d '{
  "routine_id": "rtn_01JC00000000000000000000R1",
  "for_person_id": "per_01JC000000000000000000000Z"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000FFFFFFFFFFFFFFFF",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    routine_id: "rtn_01JC00000000000000000000R1",
    for_person_id: "per_01JC000000000000000000000Z",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000FFFFFFFFFFFFFFFF

{
  "routine_id": "rtn_01JC00000000000000000000R1",
  "for_person_id": "per_01JC000000000000000000000Z"
}
Response, 404
HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R04JRXNXQZT7Z1HFBY

{
  "error": {
    "code": "person_not_found",
    "message": "That person isn't in the household. No changes were applied.",
    "details": {
      "person_id": "per_01JC000000000000000000000Z"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R04JRXNXQZT7Z1HFBY"
  }
}

A routine that isn't there

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000GGGGGGGGGGGGGGGG' \
  -d '{
  "routine_id": "rtn_01JC00000000000000000000R1",
  "title": "Nope"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000GGGGGGGGGGGGGGGG",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    routine_id: "rtn_01JC00000000000000000000R1",
    title: "Nope",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/agent.routine.update HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000GGGGGGGGGGGGGGGG

{
  "routine_id": "rtn_01JC00000000000000000000R1",
  "title": "Nope"
}
Response, 404
HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0V8KQ4FC4DG4T5YP5

{
  "error": {
    "code": "routine_not_found",
    "message": "That routine isn't there any more. No changes were applied.",
    "details": {
      "routine_id": "rtn_01JC00000000000000000000R1"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R0V8KQ4FC4DG4T5YP5"
  }
}

Change when a routine runs

The next run is worked out again from now.

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/agent.routine.update' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01M6V9CTC882J0JMTH9MM6H500' \
  -d '{
  "routine_id": "rtn_01M6V9CTC5VNP0HS02R6Q1BQHB",
  "repeat": {
    "kind": "weekly",
    "days": [
      "sun"
    ],
    "time": "17:30"
  }
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/agent.routine.update", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01M6V9CTC882J0JMTH9MM6H500",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    routine_id: "rtn_01M6V9CTC5VNP0HS02R6Q1BQHB",
    repeat: {
      kind: "weekly",
      days: [
        "sun",
      ],
      time: "17:30",
    },
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/agent.routine.update HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CTC882J0JMTH9MM6H500

{
  "routine_id": "rtn_01M6V9CTC5VNP0HS02R6Q1BQHB",
  "repeat": {
    "kind": "weekly",
    "days": [
      "sun"
    ],
    "time": "17:30"
  }
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CTC8WX7JD0FGNYT0RRM2

{
  "result": {
    "routine_id": "rtn_01M6V9CTC5VNP0HS02R6Q1BQHB",
    "next_run_at": 1794180600000
  },
  "version": 315
}

For Rigel#

Rigel's tool for this command is agent_routine_update. Rigel runs this on its own, then says what it did. The agent guide has the rest.

Rigel is in early access, and sign-up is by invitation. Open Rigel