Skip to main content

Visual multi-pick HITL gate for Hermes Agent on Slack (Block Kit buttons).

Project description

hermes-button-gate

A visual, multi-pick human-in-the-loop (HITL) gate for Hermes Agent, delivered as Slack Block Kit image buttons.

It adds one tool — button_gate — that posts choices as clickable buttons (with optional images) and blocks the agent until the user picks. It's a drop-in upgrade over the built-in clarify tool for Slack/gateway sessions.

Why

On Slack, the core clarify tool degrades to a numbered-text prompt ("type 2"). It can't:

  • show images alongside options,
  • offer more than 4 options,
  • ask for several independent picks in one message.

button_gate does all three. One call can be a single-select gate, an approve/revise gate, or a per-row A/B gate.

single group, N options        → single-select gate
single group, approve/revise   → approval gate
many groups, 2 options each     → one pick per row (e.g. A/B per cut)

Each option can carry a public image_url, so it's well suited to picking between generated images (the gate this was originally built for: an image-content pipeline's candidate-pick / approve / A-B-per-cut steps).

Scope (read this)

Slack only, gateway mode. The handler posts via the Slack Web API and resolves picks through Hermes' Slack action-handler hook. It does not support Discord/Telegram or CLI sessions — in a non-Slack session the tool returns a clear error instead of blocking.

Generalizing to Discord/Telegram is blocked on Hermes core, not on this plugin: PluginContext only exposes register_slack_action_handler. The Telegram and Discord adapters route interaction callbacks through closed dispatchers, so a plugin can send buttons but can't receive the clicks. A cross-platform register_interactive_handler(platform, pattern, callback) extension point in Hermes core would unblock it.

The bridge uses a threading.Event keyed by a per-call token, so it works in gateway mode (unlike the CLI-only inject_message). Buttons lock after a pick (chat_update removes them), and a stale-token guard prevents a leftover button from an earlier gate resolving a later one.

Install

pip install hermes-button-gate          # once published
hermes plugins enable button-gate

Or for local development, drop the package into ~/.hermes/plugins/ (directory discovery) or pip install -e . from a clone (entry-point discovery via the hermes_agent.plugins group).

Requirements

  • Hermes Agent with the Slack platform enabled and running in gateway mode.
  • SLACK_BOT_TOKEN in the environment (Hermes' Slack adapter already sets this).
  • The Slack app must have interactivity enabled so button clicks reach the gateway.

Usage

The agent calls the tool; you don't call it by hand. Schema:

{
  "question": "인물 골라줘",          // optional header
  "groups": [                          // required: one entry per independent pick
    {
      "key": "choice",                 // unique id, returned as the result key
      "label": "후보",                  // optional row label
      "options": [
        { "label": "A", "value": "cand_a", "image_url": "https://.../a.png" },
        { "label": "B", "value": "cand_b", "image_url": "https://.../b.png" }
      ]
    }
  ],
  "timeout_sec": 1800                   // optional, default 1800
}

Returns:

{ "picks": { "choice": "cand_a" }, "complete": true }

On timeout, complete is false and the response includes missing (unpicked group keys).

Development

pip install -e ".[dev]"
pytest -q

Tests are stdlib + pytest only and make no network calls (Slack and Hermes internals are stubbed / avoided), so they run in a bare environment.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hermes_button_gate-1.0.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hermes_button_gate-1.0.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file hermes_button_gate-1.0.1.tar.gz.

File metadata

  • Download URL: hermes_button_gate-1.0.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hermes_button_gate-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7c981341a9832cbd6255febdd064631a2ddb49784486df365c17571bc9f6cc92
MD5 5962bac1a1686db7366220cbf87f426d
BLAKE2b-256 9e4eb4f1d8ce13d9f08e5f9f4197c00a4e938b5aa003f5a5a0197ea9bc7851b0

See more details on using hashes here.

File details

Details for the file hermes_button_gate-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: hermes_button_gate-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hermes_button_gate-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a6d020b8e9502191ac91510e18fdd1158e81878d7961eedf5f78d2293f1a0f5
MD5 a2e1fca54bf621468e684162c6efc30f
BLAKE2b-256 7817bfe889c31161f54b819d1c2e40cf9dd7bdd0cef3b61d16b6e830fefae2e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page