# lg_agents_add_trigger: Add a trigger

Add a trigger to an agent: a schedule (cron), an event or a webhook.

- **Changes data:** yes
- **Credential scope:** `agents:write` (an API key's scopes, or what you allowed when connecting with OAuth)
- **Assistant level:** an assistant at Full; a lower level is refused

## Inputs

| Field | Type | Required | Notes |
|---|---|---|---|
| `id` | string | yes |  |
| `body` | object (type, name, enabled, cron, timezone, event, conditions, input, dedupe, max_concurrent, skill, dedupe_window_minutes) | yes |  |
| `body.type` | "schedule" \\| "event" \\| "webhook" | yes |  |
| `body.name` | string | no |  |
| `body.enabled` | boolean | no |  |
| `body.cron` | string | no | Schedules: 5-field cron, read in `timezone` |
| `body.timezone` | string | no | IANA time zone, default UTC |
| `body.event` | string | no | Events: run.finished, approval.needed, connection.created, connection.failed |
| `body.conditions` | object | no | { all: [...], any: [...] } of { path, op, value } over event.* and record.* |
| `body.input` | object | no | Run input: literals or { "$ref": "event.record_id" } / body.* / record.values.* |
| `body.dedupe` | string or null | no | A path whose value makes two firings the same (e.g. event.record_id) |
| `body.max_concurrent` | integer | no |  |
| `body.skill` | string or null | no | A skill slot of the agent this trigger runs (its instructions lead the run) |
| `body.dedupe_window_minutes` | integer | no | How long a dedupe key holds (default 24 h) |

## Example MCP call

A `tools/call` request to `https://manage.restolayer.com/mcp`:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "lg_agents_add_trigger",
    "arguments": {
      "id": "agt_01HZXEXAMPLE",
      "body": {
        "type": "schedule",
        "cron": "0 8 * * 1",
        "timezone": "America/New_York"
      }
    }
  }
}
```

## Example REST call

The same thing over REST (`POST /v1/agents/:id/triggers`):

```bash
curl -s -X POST "https://manage.restolayer.com/v1/agents/agt_01HZXEXAMPLE/triggers" \
  -H "Authorization: Bearer $LG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type":"schedule","cron":"0 8 * * 1","timezone":"America/New_York"}'
```

All tools: [MCP tools](https://www.restolayer.com/docs/mcp/tools). Connecting: [connect your assistant](https://www.restolayer.com/docs/connect).
