Skip to content

Routines

A routine binds an agent to a trigger: cron (schedule), webhook (HTTP), or API (explicit). When a trigger fires, Ren starts a session.

Create a routine

const { data: routine } = await client.pod.routine.create({
path: { podId },
body: {
projectId,
projectAgentId,
name: "Nightly digest",
prompt: "Summarise yesterday's sessions.",
},
})

projectAgentId is the id returned when you link an agent into a project.

Attach a cron trigger

await client.pod.routine.cronTrigger.create({
path: { podId, id: routine.id },
body: { schedule: "0 9 * * *", timezone: "UTC" },
})

The equivalent namespaces exist for webhook and API triggers: client.pod.routine.webhookTrigger.* and client.pod.routine.apiTrigger.*.

Pause and resume

await client.pod.routine.pause({ path: { podId, id: routine.id } })
await client.pod.routine.resume({ path: { podId, id: routine.id } })