Skip to content

feat(agent): add set_suggested_prompts helper#1442

Merged
zimeg merged 4 commits intomainfrom
zimeg-feat-agent-set-suggested-prompts
Feb 19, 2026
Merged

feat(agent): add set_suggested_prompts helper#1442
zimeg merged 4 commits intomainfrom
zimeg-feat-agent-set-suggested-prompts

Conversation

@zimeg
Copy link
Member

@zimeg zimeg commented Feb 16, 2026

Summary

This PR adds the set_suggest_prompts helper to the Bolt agent argument 👾

Testing

from logging import Logger

from slack_bolt import BoltAgent, Say


def assistant_thread_started(
    say: Say,
    agent: BoltAgent,
    logger: Logger,
):
    """
    Handle the assistant thread start event by greeting the user and setting suggested prompts.

    Args:
        say: Function to send messages to the thread from the app
        set_suggested_prompts: Function to configure suggested prompt options
        logger: Logger instance for error tracking
    """
    try:
        say("What would you like to do today?")
        agent.set_suggested_prompts(
            prompts=[
                {
                    "title": "Prompt a task with thinking steps",
                    "message": "Wonder a few deep thoughts.",
                },
                {
                    "title": "Roll dice for a random number",
                    "message": "Roll two 12-sided dice and three 6-sided dice for a pseudo-random score.",
                },
            ]
        )
    except Exception as e:
        logger.exception(f"Failed to handle an assistant_thread_started event: {e}", e)
        say(f":warning: Something went wrong! ({e})")

Category

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components

Notes

This mirrors an implementation found in context at the moment - I'm uncertain if duplicating this logic is best or what our longterm strategies are for these callsites with assistant classes:

https://github.com/slackapi/bolt-python/tree/main/slack_bolt/context/set_suggested_prompts

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_all_and_run_tests.sh after making the changes.

@zimeg zimeg requested review from mwbrooks and srtaalej February 16, 2026 20:05
@zimeg zimeg self-assigned this Feb 16, 2026
@zimeg zimeg requested a review from a team as a code owner February 16, 2026 20:05
@zimeg zimeg added enhancement New feature or request semver:patch experiment Experimental feature documented with ExperimentalWarning and pydoc Experiment section labels Feb 16, 2026
@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.66%. Comparing base (5cb6182) to head (6e4987c).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1442      +/-   ##
==========================================
+ Coverage   90.64%   90.66%   +0.01%     
==========================================
  Files         226      226              
  Lines        7187     7201      +14     
==========================================
+ Hits         6515     6529      +14     
  Misses        672      672              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@srtaalej srtaalej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 🤩 lets get this merged 😝

Copy link
Member

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: @zimeg Can you explain in more detail what you mean by:

This mirrors an implementation found in context at the moment - I'm uncertain if duplicating this logic is best or what our longterm strategies are for these callsites with assistant classes:

Are you saying that any in production today, any event listener can access context.set_suggested_prompts(...)?

Base automatically changed from feat-agent-set-status to main February 17, 2026 18:36
@zimeg
Copy link
Member Author

zimeg commented Feb 17, 2026

@mwbrooks Correct! The current context.set_suggested_prompts function appears as an argument for all listeners, but is "prepared" for assistant events:

@property
def set_suggested_prompts(self) -> Optional[SetSuggestedPrompts]:
return self.get("set_suggested_prompts")

# For AI Agents & Assistants
if is_assistant_event(req.body):
assistant = AssistantUtilities(
payload=to_event(req.body), # type:ignore[arg-type]
context=req.context,
thread_context_store=self._assistant_thread_context_store,
)
req.context["say"] = assistant.say
req.context["set_status"] = assistant.set_status
req.context["set_title"] = assistant.set_title
req.context["set_suggested_prompts"] = assistant.set_suggested_prompts
req.context["get_thread_context"] = assistant.get_thread_context
req.context["save_thread_context"] = assistant.save_thread_context

IMHO this is somewhat confusing but I'm hoping we can move toward a single approach for this?

@mwbrooks
Copy link
Member

@zimeg Ah, thanks for the clarity. It is a little confusing why set_suggested_prompts is added to the context for all listeners. Either way, I think we can now add it to the agent argument.

Copy link
Member

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Looks good to me @zimeg! Thanks for adding this to the agent argument!

Copy link
Member Author

@zimeg zimeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srtaalej @mwbrooks Thanks both for the reviews!

I'm leaving one more comment before merging that I'll follow up on since I think it's worth separate discussion - methods are somewhat inconsistent in the "channel" arguments at the moment 👾

*,
prompts: Sequence[Union[str, Dict[str, str]]],
title: Optional[str] = None,
channel: Optional[str] = None,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 note: I'm noticing this is different than the expected API value!

🔗 https://docs.slack.dev/reference/methods/assistant.threads.setSuggestedPrompts/

@zimeg zimeg merged commit 92bff60 into main Feb 19, 2026
16 checks passed
@zimeg zimeg deleted the zimeg-feat-agent-set-suggested-prompts branch February 19, 2026 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request experiment Experimental feature documented with ExperimentalWarning and pydoc Experiment section semver:patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments