agent looped on servicenow ticket updates: webhook echo feedback
This skill breaks a feedback loop where a helpdesk agent's ServiceNow update triggers a webhook that re-invokes the agent, which updates again forever. It shows how to mark agent-originated changes and ignore the echo. For agents that both write to and listen for ServiceNow changes.
TL;DR
Tag every change the agent makes with its own identity and ignore events carrying that tag. Check the event's origin before acting, and add a loop breaker that stops after a few self-triggered cycles even if the tag is missing.
Steps
Write a marker, like the agent's service account, on every update the agent makes. Expected: Agent-originated changes are identifiable.
At the start of event handling, skip any event carrying the agent's marker. Expected: Echoes are ignored.
Add a circuit breaker: if the same ticket triggers the agent more than a few times in a row, pause and alert. Expected: A missed marker cannot loop forever.
Replay a recorded echo sequence in a test to confirm the loop breaks. Expected: The test shows one handling per real change.
When to use
- The agent writes to ServiceNow and subscribes to its webhooks
- Tickets show rapid back-and-forth updates with no human involved
- API call volume spikes on a single ticket
When not to use
- The agent only reads from ServiceNow
- Webhooks and writes are on separate systems
- A human approves every update
Why this happens
ServiceNow fires webhooks for every change including the agent's own, so a write-listen agent hears its own echo as a new event. Each echo looks like fresh work, and the agent diligently redoes it, forever.
Edge cases
- Bulk updates by admins can look like echoes; the marker must be agent-specific, not update-specific.
- The circuit breaker needs a human-visible alert, or paused tickets sit silently.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_-aOfYKQDGQ6rDeMF32oauQ