Skip to content

[Feature]: Allow agent response opt out - #32879

Closed
gordan-bobic wants to merge 6 commits into
NousResearch:mainfrom
shatteredsilicon:feature/response-opt-out-with-SILENT
Closed

[Feature]: Allow agent response opt out#32879
gordan-bobic wants to merge 6 commits into
NousResearch:mainfrom
shatteredsilicon:feature/response-opt-out-with-SILENT

Conversation

@gordan-bobic

Copy link
Copy Markdown

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.py line 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

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • gateway/platforms/base.py: Added SILENT_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 and response is set to None.

How to Test

  1. Apply the patch to gateway/platforms/base.py
  2. Restart the gateway
  3. In a channel or DM, have the agent respond with exactly [SILENT] as its final response
  4. Verify no message appears in the platform — check gateway logs for: [Platform] Agent returned [SILENT] — suppressing delivery for <chat_id>

Note: This only works for the gateway's final_response delivery path. Direct send_message tool 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

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: EL10

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

Gateway log output confirming suppression:

2026-05-26 23:19:42,440 INFO gateway.platforms.base: [Mattermost] Agent returned [SILENT] — suppressing delivery for f7ebjjh3o3y87x4wddihzdotha
2026-05-27 00:01:58,868 INFO gateway.platforms.base: [Mattermost] Agent returned [SILENT] — suppressing delivery for doy68hiistbk7mucunpug6dooc

No message appeared in the Mattermost channel after the agent responded with [SILENT].

Allow agents to out out of responding by sending [SILENT], similar to
what cron jobs do.
NousResearch#32861
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels May 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Note: This PR commits gateway/platforms/base.py.orig (a 4241-line backup file) instead of modifying gateway/platforms/base.py. The .orig file appears to be the entire original base.py rather than a targeted patch adding the [SILENT] suppression check. Please remove the .orig file and apply the change directly to base.py.

Implements #32861. Related to #6643 (Telegram group response opt-out) and #9956 (gateway silent placeholder suppression).

@gordan-bobic

Copy link
Copy Markdown
Author

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.

@gordan-bobic

Copy link
Copy Markdown
Author

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.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the implementation and for correcting the initial .orig-file issue noted in the discussion. This is an automated hermes-sweeper review.

  • Current main implements the requested gateway response opt-out in gateway/response_filters.py:19 and suppresses delivery only after preserving the assistant turn in gateway/run.py:12146.
  • It also covers the streaming path in gateway/stream_consumer.py:606, addressing the limitation documented in this PR's body.
  • tests/gateway/test_gateway_silence_tokens.py:95 verifies that [SILENT] is retained in the transcript but not delivered.
  • The gateway-wide implementation landed in 293c04fef6ba34ea18090ccb555c401c23454944 (merged PR fix(gateway): suppress exact silence tokens without mutating history #46080) and shipped in v2026.6.19.

The related issue #32861 and linked #6643/#9956 behavior are covered by the current implementation.

@teknium1 teknium1 closed this Jul 13, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have sweeper:implemented-on-main Sweeper: behavior already present on current main type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Allow agents to opt out of replying with [SILENT] marker

3 participants