#7846: feat: add agentId param to webhook agent endpoint
docs
gateway
stale
There is no way (that I can find) to route a webhook to a specific agent. This PR adds the parameter to do this so tasks can be routed directly to the right agent.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds an optional `agentId` field to the `/hooks/agent` webhook payload, normalizes it (trim/empty-to-undefined) in `normalizeAgentPayload`, documents it in `docs/automation/webhook.md`, and forwards it through the gateway hook handler to `runCronIsolatedAgentTurn` so an isolated webhook-triggered run can be routed to a specific agent configuration.
<h3>Confidence Score: 4/5</h3>
- This PR is largely safe to merge; changes are small and localized with tests covering normalization.
- The `agentId` plumbing is straightforward (types, normalization, forwarding) and includes unit tests and docs. The main concern is the cron job object not capturing `agentId`, which could become a correctness issue if the job is ever persisted/replayed or if `runCronIsolatedAgentTurn` behavior changes.
- src/gateway/server/hooks.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#10663: feat(hooks): add agentId support for webhook routing
by nityatrish · 2026-02-06
87.7%
#9800: feat(hooks): allow webhook mappings to route to specific agents via a…
by bogdanClawdy · 2026-02-05
86.6%
#10383: feat(hooks): add agentId to hook mappings
by quentintou · 2026-02-06
81.2%
#8352: fix(gateway): include clientRunId in agent event payloads
by MarvinDontPanic · 2026-02-03
76.0%
#7301: fix(hooks): use resolveAgentIdFromSessionKey instead of split(":")[0]
by tsukhani · 2026-02-02
74.6%
#12635: Gateway: add inbound webhook dispatch framework
by jhs129 · 2026-02-09
74.5%
#6630: feat(hooks): add agent:turn_start and agent:turn_end lifecycle events
by drdigital13 · 2026-02-01
74.3%
#6974: Feature/webhook gateway token
by MC-shark · 2026-02-02
73.4%
#22845: Pass agentDir through cron and followup embedded runs
by seilk · 2026-02-21
72.6%
#5977: fix(ui): handle optional agentId and add updateCronJob function
by xpnobug · 2026-02-01
72.3%