N AgentNava
AgentNava · Build

Triggers

Chat is always on. Set a trigger when something else should start a run.

What starts a run

Chat is always one of them and cannot be removed, so most agents never set this. You set triggers when you want one of the others as well.

kindWho starts the turnYou give it
chata personnothing
schedulenobodya cron expression, in the timezone you name
intervalitselfseconds, and optionally maxRuns
webhookyour systemnothing. You get a URL back
await agent.setTriggers([
  { kind: 'chat' },
  {
    kind: 'schedule',
    cron: '0 8 * * 1',
    timezone: 'America/Los_Angeles',
    message: 'Summarise last week\'s failed payments over 500 dollars.',
  },
]);

message is what the agent is asked

A run with no human attached still has to be told something, or it wakes with nothing in front of it. Required on schedule and interval. Optional on webhook, where it is prepended to your payload so the agent knows what it is looking at before it sees it.

Webhooks

Setting a webhook trigger hands back a URL to POST to:

const updated = await agent.setTriggers([
  { kind: 'chat' },
  { kind: 'webhook', message: 'A support ticket arrived. Triage it.' },
]);

updated.triggers.find((t) => t.kind === 'webhook')?.url;

Every firing is a turn

And a turn is billed

An interval of 10 seconds with no maxRuns is a bill that does not stop. Set maxRuns unless you mean it to run forever.

Triggers belong to the version, like everything else that says what the agent is. A trigger's message is a prompt, so rolling an agent back brings its schedule with it. Only one schedule fires at a time: the scheduler reads the newest version. A trigger starts a new run and is never read by a conversation already in progress.