[Feature]: Allow agent response opt out - #32879
Conversation
Allow agents to out out of responding by sending [SILENT], similar to what cron jobs do. NousResearch#32861
|
Note: This PR commits Implements #32861. Related to #6643 (Telegram group response opt-out) and #9956 (gateway silent placeholder suppression). |
|
Oops, fixed the errant .orig commit. Please stand by with the review - it occurs to me that this feature isn't very useful if the agent doesn't know it exists. I am preparing an additional patch with appropriate system prompt to make the agent aware that it has a way of not responding should it choose not to. |
|
This "works for me" now. It gives the agent an option of not responding in response to anything if it doesn't think it has anything sufficiently to contribute at the current turn. The feature awareness is injected into the system prompt. |
|
Thanks for the implementation and for correcting the initial
The related issue #32861 and linked #6643/#9956 behavior are covered by the current implementation. |
Allow agents to opt out of responding by sending [SILENT], similar to what cron jobs do.
#32861
What does this PR do?
Adds a
[SILENT]sentinel marker to the agent chat pipeline. When an agent's final response is exactly[SILENT], delivery to the messaging platform is suppressed. The transcript entry is preserved for continuity.This mirrors the existing
[SILENT]behaviour already present in cron job delivery (cron/scheduler.pyline 1754) and brings it to the agent response path. Useful in group channels where an agent has nothing meaningful to add, or when an agent is present as a listener rather than an active participant.Related Issue
Fixes #32861
Type of Change
Changes Made
gateway/platforms/base.py: AddedSILENT_MARKER = "[SILENT]"constant and suppression check in_process_message_background()after_unwrap_ephemeral(). If the agent's response is exactly[SILENT], delivery is suppressed with an INFO log andresponseis set toNone.How to Test
gateway/platforms/base.py[SILENT]as its final response[Platform] Agent returned [SILENT] — suppressing delivery for <chat_id>Note: This only works for the gateway's
final_responsedelivery path. Directsend_messagetool calls bypass this mechanism and will still post to the platform. Streaming mode is not yet supported — chunks are sent before the check runs.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Gateway log output confirming suppression:
No message appeared in the Mattermost channel after the agent responded with
[SILENT].