Skip to content

feat(agent): add set_suggested_prompts helper - #1442

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

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

Conversation

@zimeg

Copy link
Copy Markdown
Member

Summary

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

Testing

fromloggingimportLoggerfromslack_boltimportBoltAgent, Saydefassistant_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.",
},
]
)
exceptExceptionase:
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.

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

codecovBot commented Feb 16, 2026

Copy link
Copy Markdown

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.

@srtaalejsrtaalej left a comment

Copy link
Copy Markdown
Contributor

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 😝

@mwbrooksmwbrooks left a comment

Copy link
Copy Markdown
Member

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 mainFebruary 17, 2026 18:36
@zimeg

Copy link
Copy Markdown
MemberAuthor

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

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

# For AI Agents & Assistants
ifis_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
Copy Markdown
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.

@mwbrooksmwbrooks left a comment

Copy link
Copy Markdown
Member

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!

@zimegzimeg left a comment

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

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 mainFeb 19, 2026
16 checks passed
@zimeg
zimeg deleted the zimeg-feat-agent-set-suggested-prompts branch February 19, 2026 02:24
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or requestexperimentExperimental feature documented with ExperimentalWarning and pydoc Experiment sectionsemver:patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@zimeg@mwbrooks@srtaalej