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

# Custom trigger agents

> Start an agent when a system you connect calls its webhook URL, with no PSA ticket

A custom trigger is a trigger from a system you connect, not from your PSA. A custom-triggered agent starts when that system calls Neo, such as a Samsara geofence arrival, a HubSpot deal won, or an n8n, Zapier or Power Automate flow. It runs without a PSA ticket, and the system's message is the agent's starting context.

The first source of a custom trigger is a **webhook**: a URL that the other system calls with a JSON body. Each call starts one run of the agent.

## Triggered, custom-triggered and scheduled agents

| | Triggered agent | Custom-triggered agent | Scheduled agent |
| - | - | - | - |
| **Starts when** | A PSA event occurs | A system you connect calls the agent's webhook | A schedule fires |
| **Works on** | A ticket or time entry | The JSON body of the call | Its instructions alone |
| **Credits** | Once per run | Each tool call, at its [per-call price](https://docs.neoagent.io/agents/tools/credit-costs.md) | Each tool call, at its per-call price |

An agent keeps its trigger type for life: you cannot turn a triggered agent into a custom-triggered one. To change it, create a new agent.

## Create a custom trigger agent

**1. Start a new agent**

Open [**Agents**](https://dashboard.neoagent.io/) and press [**New custom triggered agent**](https://dashboard.neoagent.io/agents/create?startedBy=CUSTOM_TRIGGERED) in the header of the **Custom triggered** table. You can also start any new agent and pick **Custom triggered** under **Started by** on its **Triggers & Filters** tab.

**2. Tell Neo where the idempotency key is**

Under **Trigger when** → **Webhook is called**, pick **Header** or **Body path** and name the field that carries a unique id for each call (see [Skip a repeated call](#skip-a-repeated-call)). Leave **No key** if the system sends no such id. You can change it later.

**3. Save and copy the URL**

Write the agent's instructions and save. Neo adds the webhook and shows its URL in the **Copy your webhook URL** dialog. Press **Copy** and paste the URL into the other system.

**Started by** is fixed once the agent is saved. Project ticket and opportunity agents can only be triggered.

Neo Support and the public API can do the same: create the agent with `trigger_type: CUSTOM_TRIGGERED`, then `POST /public-api/agents/{id}/webhook`.

## The webhook URL

```
https://api.neoagent.io/hooks/wh_7kq2mx9plr4tyb3n/neowh_…
```

The part after the webhook id is the **secret**. Anyone who has the URL can start runs of the agent, so keep it as you keep a password.

The agent's **Triggers & Filters** tab shows the URL with its secret hidden. Press **Show** to read it, or **Copy** to copy it without showing it. The API gives the same URL with `GET /public-api/agents/{id}/webhook`.

The URL starts runs, so only a person who can edit the agent and run it can see, add or rotate it. An [API key](https://docs.neoagent.io/developers/authentication.md#limit-a-key-with-scopes) needs `agents:write` and `executions:write` for it.

* **Rotate the secret** when the URL has leaked: press **Rotate secret…**, then **Rotate secret** (or `POST /public-api/agents/{id}/webhook/rotate`). Neo shows the new URL, and the old one stops working at once.
* **Delete the webhook** with `DELETE /public-api/agents/{id}/webhook`. Its URL then answers `404`, and the agent shows **Add webhook**, which gives a new URL. The dashboard has no delete button.

## What a call does

The system sends `POST` to the URL with a JSON body of at most 256 KB. Any JSON value works, an array included. Neo checks the secret, saves the call, and starts the run. The agent reads the body as data from outside Neo, below its own instructions. Whoever has the URL writes that body, and the agent can do only what its tools and approvals allow, so give an agent that changes records approvals on its writes.

| Answer | Meaning |
| - | - |
| `202` | The run started. The body is `{"execution_id": "…", "duplicate": false}`. The answer never holds the agent's output. |
| `202` with `"duplicate": true` | A call with the same idempotency key already started a run, and no new run started. |
| `400` | The body is not JSON, is nested deeper than 32 levels, or has an object key longer than 256 characters. |
| `404` | No webhook at this URL: a wrong id or secret, a deleted webhook, or a deleted agent. |
| `409` | The agent is turned off. Turn it on to start runs. |
| `413` | The body is larger than 256 KB. |
| `429` | The call is over a limit. Wait for the `Retry-After` seconds and send it again. |
| `503` | Neo could not start the run, or a call with the same idempotency key is still starting one. Send the call again after the `Retry-After` seconds. |

## Skip a repeated call

Many systems send a call again when they get no answer in time. To stop a repeated call from starting a second run, tell Neo where each call carries a unique id, its **idempotency key**:

* a header, such as `X-Event-Id`, or
* a path in the body, such as `event.id` or `items[0].id` (keys and array indexes only).

Set it on the agent's **Triggers & Filters** tab: open **Webhook settings**, then set **Idempotency key**. The default is **No key**. You can also set it with `PATCH /public-api/agents/{id}/webhook`. For 7 days, a second call with the same key starts no run and answers `202` with the first run's `execution_id`. A call whose earlier run did not start, such as one that got `429` or `503`, runs when it is sent again. A call without the key always starts a run.

## Limits

| Limit | Default | You can set |
| - | - | - |
| Calls a minute, per webhook | 30 | 1 to 500 |
| Runs a day, per webhook | 500 | 1 to 20,000 |

A call over a limit gets `429` with `Retry-After` and starts no run. The daily limit counts the last 24 hours, not the calendar day. Set the limits in **Calls a minute** and **Runs a day**, under **Webhook settings** on the agent's **Triggers & Filters** tab, before or after the first save. The API takes them when it adds the webhook or with `PATCH /public-api/agents/{id}/webhook` (`calls_per_minute_limit`, `runs_per_day_limit`), or ask Neo Support. Neo also limits all webhook calls of one account to 1,000 a minute, and wrong URLs from one address to 10 a minute.

## Price

A custom-triggered agent pays for each tool call at its [per-call price](https://docs.neoagent.io/agents/tools/credit-costs.md), as a scheduled agent does. A run whose tools are all free still bills 1 credit. So a run that only reads the body and stops costs 1 credit.

## The call log

Neo keeps each call for 30 days: when it came, the answer it got, the run it started, and its body. Of the calls that start no run, Neo keeps the first of each answer in a minute, so a system in a loop does not fill the log.

On the agent's **Triggers & Filters** tab, open **Webhook details** to see the **Last 20 calls**, newest first. The table shows when each call came, its answer code and what came of it. **Open run ›** opens the run it started, and **View body ›** shows the body as it came. The API reads the same latest calls, at most 20, with `GET /public-api/agents/{id}/calls`, which needs `executions:read` on an API key. You can also ask Neo Support why a call did not start a run.

Above the list, **Last 24 hours** counts the calls, the runs they started, the duplicates and the refused calls (over a limit, or a body that is not JSON). The duplicate and refused counts read "at least", because the log keeps only the first of each in a minute. Once the agent has billed runs, the line also shows about how many credits a run costs, from the agent's recent runs.

## Test the agent

**Send test call…** on the agent's **Triggers & Filters** tab starts a run on a body you choose: the body of the last real call, or your own JSON. **Run now** on the **Agents** page does the same, and so does `POST /public-api/agents/{id}/run-now` with the body in `test_body` (any JSON value, `null` included). A test call is marked **Test** in the call log, and the run works on it as on a real call. It does not count against the webhook's limits.

To run the agent again on a call's body, retry the run; after 30 days the call is gone, and the retry is refused.


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