Skip to content

feat: Telegram inline keyboard buttons for tool approval prompts #536

@njbrake

Description

@njbrake

Context

The progressive approval system (#535-adjacent) currently sends plain-text prompts when a tool needs user approval:

The assistant wants to use the tool 'web_fetch':
fetch content from https://example.com

Reply: yes | no | always | never

The user replies by typing "yes", "no", "always", or "never" as a regular text message. This works but is not the ideal Telegram UX.

Proposal

Use Telegram inline keyboard buttons to present the four approval options as tappable buttons instead of requiring the user to type a response.

Implementation ideas

  • In the Telegram channel adapter, add a send_approval_prompt(to, tool_name, description) method (or extend send_text with an optional reply_markup parameter) that attaches an InlineKeyboardMarkup with four buttons: Yes, No, Always, Never.
  • Handle the CallbackQuery from Telegram's webhook to resolve the approval gate, similar to how process_inbound_from_bus() intercepts text replies today.
  • After the user taps a button, edit the original message to show the decision (e.g. "Approved: web_fetch") and answer the callback query.
  • Consider whether MessagingService should grow a channel-agnostic send_approval_prompt() method or whether this stays Telegram-specific.

References

  • Approval system: backend/app/agent/approval.py
  • Ingestion intercept: backend/app/agent/ingestion.py (top of process_inbound_from_bus)
  • Telegram adapter: backend/app/channels/telegram.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions