---
title: "It wakes up on its own · Tempo AI Platform docs"
description: "How an agent wakes on its own: schedules that start a turn on a cron or every few minutes, and GitHub events on the repositories you connected."
url: "https://gateway.tempo-dev.workers.dev/docs/guides/triggers"
---

> Every page of the Tempo AI Platform is Markdown at its URL with .md, or with Accept: text/markdown. The index of every page is https://gateway.tempo-dev.workers.dev/llms.txt, the API https://gateway.tempo-dev.workers.dev/openapi.json and the MCP server https://gateway.tempo-dev.workers.dev/mcp.

# It wakes up on its own

An agent runs when someone calls it: a turn over the API, MCP or SSH. A trigger lets something else start that turn. A schedule wakes it on a cron in your time zone or every few minutes, and a GitHub subscription wakes it when a pull request opens, someone mentions it in a comment, an issue is labeled or CI fails. Each trigger keeps a prompt, and every turn it starts is billed to the key that set it, exactly like a turn you sent.

[Get your Tempo Key](https://gateway.tempo-dev.workers.dev/key.md) · [Agents reference](https://gateway.tempo-dev.workers.dev/docs/agents.md)

## Architecture

```text
POST /v1/agents/:id/triggers  {prompt, schedule | github}
  -> a row in D1 for this agent, with the key that set it
       |                                   |
every minute, the Worker's cron        GitHub App webhook
  rows whose next_at has passed          POST /v1/github/webhook
  claim the slot, set the next one       X-Hub-Signature-256 checked
       |                                   rows on that repository
       |                                   whose events match
       v                                   v
  skip while this trigger's last turn still runs
  else a turn with the stored prompt (and the event's summary),
  billed to the key, or a steer of the agent's running turn
```

A trigger is a row beside the agent; the every-minute cron and GitHub's webhook both end in the same turn.

## Schedules

**Weekday stand-up at 9:00 in New York**

```sh
curl -X POST https://gateway.tempo-dev.workers.dev/v1/agents/support/triggers \
  -H "Authorization: Bearer $TEMPO_KEY" -H 'Content-Type: application/json' \
  -d '{"prompt": "Summarize yesterday'\''s support tickets and open questions.",
       "schedule": {"cron": "0 9 * * 1-5", "timezone": "America/New_York"}}'
```

- **cron**\
  Five fields, minute hour day-of-month month day-of-week, with `*`, lists, ranges, steps and month or day names, or `@hourly`, `@daily`, `@weekly`, `@monthly` and `@yearly`. When both day fields are set, either one matching is enough, as in Unix cron.
- **timezone**\
  An IANA name such as `Europe/Athens`; UTC by default. A time a clock change skips does not fire that day, and a time it repeats fires once.
- **every**\
  Instead of cron: every this many minutes, at least 5.

A schedule fires at most once every 5 minutes, whatever its cron says, and a slot the gateway missed fires once, not once per missed slot. The turn's prompt starts with a line naming the trigger and the slot it was due, then your prompt.

## GitHub events

Connect GitHub in the [console](https://gateway.tempo-dev.workers.dev/console.md#connectors) first, and give the Tempo AI Platform GitHub App the repository: GitHub sends events only from repositories the app is installed on, and setting a trigger checks both.

**Review pull requests and answer mentions**

```sh
curl -X POST https://gateway.tempo-dev.workers.dev/v1/agents/reviewer/triggers \
  -H "Authorization: Bearer $TEMPO_KEY" -H 'Content-Type: application/json' \
  -d '{"prompt": "Review this and comment on the pull request:\n\n{{event}}",
       "github": {"repository": "acme/api",
                  "events": ["pull_request.opened", "pull_request.synchronize", "mention"]}}'
```

| Event                                        | Fires when                                                                                                                |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| pull_request.opened, .synchronize, .reopened | A pull request opens, gets new commits or reopens                                                                         |
| issues.opened                                | An issue opens                                                                                                            |
| issues.labeled                               | An issue gets a label; with `labels`, only those                                                                          |
| mention                                      | A new issue, pull request or review comment, or a review, names the agent: its persona, or `mention`, with or without `@` |
| check_suite.failed                           | A check suite ends in failure, timed_out or startup_failure                                                               |
| workflow_run.failed                          | An Actions workflow run ends the same way                                                                                 |

The event's summary (number, title, author, branch, link and the quoted body) goes where the prompt says `{{event}}`, or after it. Pull requests, issues (labeled ones too) and comments wake the agent only when the author of the text quoted in the prompt is the repository's owner, a member or a collaborator; set `anyone: true` to take everyone's. A turn that outside text started this way does not act as you on GitHub. Comments and reviews posted through the Tempo AI Platform GitHub App or by a bot account never fire, so an agent answering a mention does not wake itself, and one trigger starts at most 30 turns an hour. Each delivery fires once, and the gateway checks again that your GitHub connection still sees the repository before it starts the turn.

## Cost and safety

- Setting, listing and deleting triggers is free. Each turn costs what any turn of the agent costs, billed to the key that set the trigger, and an agent backed by an app or budget is paid the same way.
- A trigger is skipped, and its `last.outcome` says `skipped`, while the turn it started last is still running. If the agent is busy with another turn, the trigger steers that turn instead (`steered`).
- Only the agent's owner sets its triggers. Deleting the agent deletes them.
- `last` shows when a trigger fired, its outcome (`started`, `steered`, `skipped` or `failed`) and the turn, to poll at `/v1/agents/:id/turns/:turn`.

| Route                                   | What it does                                                      | Price |
| --------------------------------------- | ----------------------------------------------------------------- | ----- |
| GET /v1/agents/:id/triggers             | The agent's triggers, with nextAt for schedules and last for each | free  |
| POST /v1/agents/:id/triggers            | Add one: { prompt, schedule \| github }; with id, replace it      | free  |
| DELETE /v1/agents/:id/triggers/:trigger | Delete one                                                        | free  |
| POST /v1/github/webhook                 | Where the GitHub App sends events, signed with its webhook secret | free  |

Over MCP the same calls are `triggers_list`, `triggers_set` and `triggers_delete`.

[<- It's customizable](https://gateway.tempo-dev.workers.dev/docs/guides/personas.md) · [It can pay for its own compute, memory and storage ->](https://gateway.tempo-dev.workers.dev/docs/guides/resources.md)
