Article · Updated November 1, 2026 · By the Hooks team
Trigger an AI agent from a webhook
Short answer: To trigger an AI agent from a webhook, point the provider at a gateway endpoint, filter to the events that matter, render a task payload with a template, and forward it to the agent's HTTP endpoint. The gateway keeps the retries and delivery log, so a temporarily unavailable agent does not lose the event.
The hard part is not the HTTP call; it is deciding which events deserve an agent run, and what the agent should receive. Both are configuration, not code.
The four steps
1. Create an endpoint and give the provider its URL, so GitHub, Stripe, or Linear starts posting there.
2. Add a filter. A push to the default branch is usually worth an agent run; a bot comment rarely is.
3. Add a template that builds the agent task from the event: fixed instruction text plus selected event fields.
4. Add the agent's destination URL and a secret. Hooks signs each forwarded request, and retries with exponential backoff if the agent is down.
Keep the task envelope small
Pass the fields the agent needs and a stable event id, not the entire provider payload. Smaller envelopes are cheaper to process, easier to audit, and less exposed to prompt injection from user-controlled fields such as issue titles or commit messages.
Template
{
"task": "Summarize this push and list risky changes",
"event_id": "{{ event.id }}",
"repo": "{{ event.subject.name }}",
"compare_url": "{{ event.payload.compare }}"
}What happens when the agent is unavailable
The delivery is queued and retried with exponential backoff. Every attempt keeps the same delivery id, so the agent can deduplicate if it processes a request but the response is lost. When retries run out, the delivery is marked failed and can be replayed from the log.
Frequently asked questions
Which agents work as a Hooks destination?
Any HTTPS endpoint that accepts a JSON POST, including Grok Bot routines, t3code, and Paseo. The target guides cover the request shape each one expects.
Should the agent receive the raw provider payload?
Prefer a template with the fields you need. Forwarding the raw body hands the agent every user-controlled string in the event, which is exactly the input prompt injection relies on.