> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gettrillion.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Rules, schedules and connected accounts

> Make Trillion run a tool or workflow by itself when something happens or at a set time.

Rules and schedules run a tool or start a workflow with no AI in the loop: a rule when something happens (a message is recorded, a comment arrives, something is added to a shared space), a schedule at a time. Connected accounts, such as your Instagram, are where outside events come from.

You do not call these tools yourself. You ask your AI in plain words, and it picks the tool. This page shows what each one does, so you know what to ask for.

## Set what happens by itself when something happens

`set_rule` · Changes things

Makes this person's Trillion do something by itself whenever something happens: a tool runs, or a workflow starts, with no AI in the loop. when says what sets it off, one of three ways. (1) Something recorded in this Trillion: \{ "recorded": "message" } (or "pursuit", "decision", or any other kind of record this account keeps), with optional where tests on the record's fields, all of which must hold: \{ "field": "text", "contains": "invoice" }, or equals, one\_of (a list), starts\_with, present: true. (2) An event from outside, such as a comment or a direct message: \{ "source\_id": "events:instagram", "event": "comment", "words": \["tennis"] }; words (optional) must appear in the event, whole\_word (default true) and field (default text) say how; once\_per (optional) names an event field to act once per value of, like "from\_id" for once per person. (3) Something added to a shared space this person is in, by any member (made there or shared from their private Trillion): \{ "space\_id": "membership\_..." } from `list_spaces`, with optional kind (only items of that kind, like "decision" or "message") and where tests on the item's fields as `read_space` shows it (title, kind, body.text and so on). It runs in this person's own Trillion and sees only what the space shows its members, never anyone's private records. Only a space this person is in now can be named; if they leave it, the rule stops and `list_rules` says so. then names what runs: \{ "tool\_id", "input" } or \{ "workflow\_id", "input" }, where an input value \{ "fill": \{ "from": "record", "field": "text" } } is taken from the record ("id" is the record's own id), \{ "fill": \{ "from": "item", "field": "title" } } from the space item (item\_id, kind, title, body, space\_id), or \{ "fill": \{ "from": "event", "field": "comment\_id" } } from the event. It runs once for each thing that sets it off, never twice for the same thing, and only for what happens after the rule is set. Example: \{ "when": \{ "recorded": "message", "where": \[\{ "field": "text", "contains": "invoice" }] }, "then": \{ "tool\_id": "tool:...", "input": \{ "note": \{ "fill": \{ "from": "record", "field": "text" } } } }, "label": "file every invoice mentioned" }. Give rule\_id to change an existing rule. enabled (default true, and an existing rule keeps its own) turns it on or off: an off rule never fires; give only rule\_id and enabled to turn it on or off and keep everything else. An event rule needs `listen_for_events` on its source once.

**Inputs**

| Input | Type | Required | What it is |
| - | - | - | - |
| `rule_id` | string | | A rule\_id from `list_rules` |
| `when` | object | | \{ recorded, where } for a record written in this Trillion, \{ space\_id, kind, where } for something added to a shared space this person is in, or \{ source\_id, event, words, whole\_word, field, once\_per } for an event from outside |
| `when.recorded` | string | | The kind of record, like message, pursuit or decision |
| `when.space_id` | string | | A shared space this person is in (from `list_spaces`): the rule runs when something is added there |
| `when.kind` | string | | With space\_id: only items of this kind, like decision or message |
| `when.where` | object\[] | | |
| `when.where[].field` | string | Yes | |
| `when.where[].equals` | any | | |
| `when.where[].one_of` | array | | |
| `when.where[].starts_with` | string | | |
| `when.where[].contains` | string | | |
| `when.where[].present` | boolean | | |
| `when.source_id` | string | | |
| `when.event` | string | | |
| `when.words` | string\[] | | |
| `when.whole_word` | boolean | | |
| `when.field` | string | | |
| `when.once_per` | string | | |
| `then` | object | | What runs: \{ "tool\_id": "tool:...", "input": \{...} } (a tool from `find_tool_for_job`) or \{ "workflow\_id": "workflow:...", "input": \{...} } (a workflow from `find_workflow`) |
| `then.tool_id` | string | | |
| `then.workflow_id` | string | | |
| `then.input` | object | | |
| `label` | string | | What the rule is for, in plain words |
| `enabled` | boolean | | On (true) or off (false) |

```json Example theme={null}
{
  "when": {
    "source_id": "events:instagram",
    "event": "comment",
    "words": [
      "GUIDE"
    ],
    "once_per": "from_id"
  },
  "then": {
    "tool_id": "<tool_id>",
    "input": {
      "comment": {
        "fill": {
          "from": "event",
          "field": "comment_id"
        }
      }
    }
  },
  "label": "Send my guide to anyone who comments GUIDE"
}
```

## List my rules

`list_rules` · Reads only

This person's rules (from `set_rule`): each rule\_id, when, then, label and whether it is on (enabled); which outside sources are being listened to; the latest runs the rules started (with any problem); a rule about a shared space the person has left shows stopped, saying why; and the latest events that arrived with what each rule did (task ids readable with `read_task`). It changes nothing.

It takes no inputs.

```json Example theme={null}
{}
```

## Remove a rule

`remove_rule` · Changes things and can remove them

Removes one of this person's rules by rule\_id (from `list_rules`), so nothing runs for it any more. Runs it already started and their results stay. It does not stop listening to an outside source; `listen_for_events` with stop true does.

**Inputs**

| Input | Type | Required | What it is |
| - | - | - | - |
| `rule_id` | string | Yes | A rule\_id from `list_rules` |

```json Example theme={null}
{
  "rule_id": "<rule_id>"
}
```

## Set something to run at a time

`set_schedule` · Changes things

Makes this person's Trillion run a tool or start a workflow at a time, by itself, with nobody calling. Give every for a repeating time: \{ "unit": "day" or "week", "at": "09:00" (24-hour local time), "time\_zone": "America/New\_York", "on": \["monday", "tuesday", "wednesday", "thursday", "friday"] for a week, "interval": 2 for every other day or week }; clock changes are handled (a time that does not exist that night runs at the first minute that does). Or give once\_at for one time: "2026-10-01T09:00:00-04:00". then names what runs: \{ "tool\_id", "input" } or \{ "workflow\_id", "input" }. starts\_on (optional, "2026-10-01") is the first day it may run; a repeating schedule set after today's time starts with its next time. Example, every weekday at nine in New York: \{ "every": \{ "unit": "week", "on": \["monday", "tuesday", "wednesday", "thursday", "friday"], "at": "09:00", "time\_zone": "America/New\_York" }, "then": \{ "workflow\_id": "workflow:...", "input": \{} }, "label": "morning review" }. Returns the next time it runs. Give schedule\_id to change an existing schedule. enabled (default true, and an existing schedule keeps its own) turns it on or off: an off schedule never runs, and turned back on it counts from now, never catching up the times it was off for; give only schedule\_id and enabled to turn it on or off and keep everything else.

**Inputs**

| Input | Type | Required | What it is |
| - | - | - | - |
| `schedule_id` | string | | A schedule\_id from `list_schedules` |
| `every` | object | | |
| `every.unit` | string | | One of `day`, `week`. |
| `every.at` | string | | Local time, like 09:00 |
| `every.time_zone` | string | | Like America/New\_York |
| `every.on` | string\[] | | Days, for a week: monday ... sunday |
| `every.interval` | integer | | |
| `once_at` | string | | One time, with its zone |
| `starts_on` | string | | First day it may run, like 2026-10-01 |
| `then` | object | | What runs: \{ "tool\_id": "tool:...", "input": \{...} } (a tool from `find_tool_for_job`) or \{ "workflow\_id": "workflow:...", "input": \{...} } (a workflow from `find_workflow`) |
| `then.tool_id` | string | | |
| `then.workflow_id` | string | | |
| `then.input` | object | | |
| `label` | string | | What the schedule is for, in plain words |
| `enabled` | boolean | | On (true) or off (false) |

```json Example theme={null}
{
  "every": {
    "unit": "week",
    "on": [
      "monday",
      "tuesday",
      "wednesday",
      "thursday",
      "friday"
    ],
    "at": "09:00",
    "time_zone": "America/New_York"
  },
  "then": {
    "workflow_id": "<workflow_id>",
    "input": {}
  },
  "label": "Morning review"
}
```

## List my schedules

`list_schedules` · Reads only

This person's schedules (from `set_schedule`): each schedule\_id, when it repeats or the one time, what runs, whether it is on (enabled), when it runs next (none while off), and its last run (with the task\_id or run\_id to read with `read_task` or `read_workflow_run`). It changes nothing.

It takes no inputs.

```json Example theme={null}
{}
```

## Run a rule or schedule now

`run_now` · Changes things

Runs a rule's or a schedule's then once, now, on the same road `run_tool` and `start_workflow` take (so the plan checks hold), whether the rule or schedule is on or off. Give rule\_id (from `list_rules`) or schedule\_id (from `list_schedules`). A then input value filled from a record or event is left out, since nothing set it off; input (optional) is laid over the then's own input to supply it. Each call runs once more. Returns the task\_id (`read_task`) or run\_id (`read_workflow_run`); the run shows as the rule's latest run or the schedule's last\_run.

**Inputs**

| Input | Type | Required | What it is |
| - | - | - | - |
| `rule_id` | string | | A rule\_id from `list_rules` |
| `schedule_id` | string | | A schedule\_id from `list_schedules` |
| `input` | object | | Values laid over the then's own input |

```json Example theme={null}
{}
```

## Remove a schedule

`remove_schedule` · Changes things and can remove them

Removes one of this person's schedules by schedule\_id (from `list_schedules`), so it never runs again. Runs it already started and their results stay.

**Inputs**

| Input | Type | Required | What it is |
| - | - | - | - |
| `schedule_id` | string | Yes | A schedule\_id from `list_schedules` |

```json Example theme={null}
{
  "schedule_id": "<schedule_id>"
}
```

## List my connected accounts

`list_connections` · Reads only

Lists the accounts this person has connected to Trillion, one row each: connection\_id, service, vendor, account\_label, status, can\_send and when it was connected. The sealed values themselves are never returned. Check here before creating or asking about an account, and connect a new one with `connect_service`, or with `run_tool` on tool:connect-service-\<vendor> for a service that takes typed values.

It takes no inputs.

```json Example theme={null}
{}
```

## Connect one of my accounts

`connect_service` · Changes things

Makes a one-time link (15 minutes) that connects one of this person's accounts, such as their Instagram, by signing in on that service's own page. Give the link to the person; the access it grants is sealed in their account, and comments and messages start arriving for their rules. service is the service's name, for example "instagram"; an unknown name lists the ones that can be connected.

**Inputs**

| Input | Type | Required | What it is |
| - | - | - | - |
| `service` | string | Yes | |

```json Example theme={null}
{
  "service": "instagram"
}
```

## Start receiving comments and messages

`listen_for_events` · Changes things

Starts receiving events from a source for this person's own connected account (for example their Instagram comments and messages): reads which account the connection belongs to, and asks the service to send its events here. Connect the service first. stop: true stops listening.

**Inputs**

| Input | Type | Required | What it is |
| - | - | - | - |
| `source_id` | string | Yes | |
| `stop` | boolean | | |

```json Example theme={null}
{
  "source_id": "events:instagram"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.