Skip to content

Commit 12c2da5

Browse files
authored
docs: updates for agent_view release (#1543)
1 parent 23120cc commit 12c2da5

2 files changed

Lines changed: 70 additions & 19 deletions

File tree

docs/english/concepts/adding-agent-features.md

Lines changed: 63 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ slack install -E local
4242

4343
5. Enable MCP for your app:
4444
- Run `slack app settings` to open your app's settings
45-
- Navigate to **Agents & AI Apps** in the left-side navigation
45+
- Navigate to **Agents** in the left-side navigation
4646
- Toggle **Model Context Protocol** on
4747

4848
6. Update your `.env` OAuth environment variables:
@@ -80,11 +80,10 @@ Agents can be invoked throughout Slack, such as via @mentions in channels, messa
8080
import re
8181
from logging import Logger
8282

83-
from agents import Runner
8483
from slack_bolt import BoltContext, Say, SayStream, SetStatus
8584
from slack_sdk import WebClient
8685

87-
from agent import CaseyDeps, casey_agent
86+
from agent import CaseyDeps, run_casey
8887
from thread_context import conversation_store
8988
from listeners.views.feedback_builder import build_feedback_blocks
9089

@@ -201,14 +200,62 @@ def handle_message(
201200

202201
</TabItem>
203202

204-
<TabItem value="assistant" label = "Assistant thread">
203+
<TabItem value="dm" label = "Agent DM">
205204

206205
:::tip[Using the Assistant side panel]
207-
The Assistant side panel requires additional setup. See the [Assistant class guide](/tools/bolt-python/concepts/using-the-assistant-class).
206+
The assistant messaging experience requires additional setup. See the [Assistant class guide](/tools/bolt-python/concepts/using-the-assistant-class).
208207
:::
209208

209+
How you greet a user and set suggested prompts when they open the agent's DM depends on which [messaging experience](/ai/developing-agents) your app uses:
210210

211-
```py
211+
* The **agent messaging experience** (`agent_view`) is the default and the only experience available to apps going forward. Conversations happen in the app's **Messages** tab, so you listen for the [`app_home_opened`](/reference/events/app_home_opened) event and check for the `messages` tab to detect when a user opens the DM, then set suggested prompts at the top of the tab (no `thread_ts` required). Casey uses this approach.
212+
* The **assistant messaging experience** (`assistant_view`) is the legacy experience, with separate **Chat** and **History** tabs. You listen for the [`assistant_thread_started`](/reference/events/assistant_thread_started) event to detect a thread, then set suggested prompts on it. Existing apps can continue to use this but should migrate to the agent messaging experience.
213+
214+
Refer to the [agent messaging experience changelog entry](/changelog/2026/06/30/agent-messages-tab) for the full list of changes and a migration checklist.
215+
216+
<Tabs groupId="messaging-experience">
217+
<TabItem value="agent_view" label = "agent_view (default)">
218+
219+
```python
220+
from logging import Logger
221+
222+
from slack_bolt import BoltContext
223+
from slack_sdk import WebClient
224+
225+
SUGGESTED_PROMPTS = [
226+
{"title": "Reset Password", "message": "I need to reset my password"},
227+
{"title": "Request Access", "message": "I need access to a system or tool"},
228+
{"title": "Network Issues", "message": "I'm having network connectivity issues"},
229+
]
230+
231+
232+
def handle_app_home_opened(
233+
client: WebClient, event: dict, context: BoltContext, logger: Logger
234+
):
235+
"""Handle app_home_opened events.
236+
237+
Under agent_view, this event fires for both the Home tab and the Messages
238+
tab (the agent DM). Branch on ``event["tab"]``.
239+
"""
240+
try:
241+
if event.get("tab") == "messages":
242+
# Suggested prompts pin to the top of the Messages tab; no thread_ts required.
243+
client.assistant_threads_setSuggestedPrompts(
244+
channel_id=event["channel"],
245+
title="How can I help you today?",
246+
prompts=SUGGESTED_PROMPTS,
247+
)
248+
return
249+
250+
# event["tab"] == "home": publish your App Home Block Kit view here
251+
except Exception as e:
252+
logger.exception(f"Failed to handle app_home_opened: {e}")
253+
```
254+
255+
</TabItem>
256+
<TabItem value="assistant_view" label = "assistant_view (legacy)">
257+
258+
```python
212259
from logging import Logger
213260

214261
from slack_bolt.context.set_suggested_prompts import SetSuggestedPrompts
@@ -236,6 +283,9 @@ def handle_assistant_thread_started(
236283
</TabItem>
237284
</Tabs>
238285

286+
</TabItem>
287+
</Tabs>
288+
239289
---
240290

241291
## Setting status {#setting-assistant-status}
@@ -395,7 +445,7 @@ from logging import Logger
395445
from slack_bolt import BoltContext, Say, SayStream, SetStatus
396446
from slack_sdk import WebClient
397447

398-
from agent import CaseyDeps, casey_agent, get_model
448+
from agent import CaseyDeps, run_casey
399449
from thread_context import conversation_store
400450
from listeners.views.feedback_builder import build_feedback_blocks
401451

@@ -456,13 +506,9 @@ def handle_app_mentioned(
456506
channel_id=channel_id,
457507
thread_ts=thread_ts,
458508
message_ts=event["ts"],
509+
user_token=context.user_token,
459510
)
460-
result = casey_agent.run_sync(
461-
cleaned_text,
462-
model=get_model(),
463-
deps=deps,
464-
message_history=history,
465-
)
511+
result = run_casey(cleaned_text, deps, message_history=history)
466512

467513
# Stream response in thread with feedback buttons
468514
streamer = say_stream()
@@ -554,6 +600,7 @@ def handle_app_mentioned(
554600
channel_id=channel_id,
555601
thread_ts=thread_ts,
556602
message_ts=event["ts"],
603+
user_token=context.user_token,
557604
)
558605
response_text, new_session_id = run_casey_agent(
559606
cleaned_text, session_id=existing_session_id, deps=deps
@@ -583,11 +630,10 @@ def handle_app_mentioned(
583630
import re
584631
from logging import Logger
585632

586-
from agents import Runner
587633
from slack_bolt import BoltContext, Say, SayStream, SetStatus
588634
from slack_sdk import WebClient
589635

590-
from agent import CaseyDeps, casey_agent
636+
from agent import CaseyDeps, run_casey
591637
from thread_context import conversation_store
592638
from listeners.views.feedback_builder import build_feedback_blocks
593639

@@ -654,8 +700,9 @@ def handle_app_mentioned(
654700
channel_id=channel_id,
655701
thread_ts=thread_ts,
656702
message_ts=event["ts"],
703+
user_token=context.user_token,
657704
)
658-
result = Runner.run_sync(casey_agent, input=input_items, context=deps)
705+
result = run_casey(input_items, deps)
659706

660707
# Stream response in thread with feedback buttons
661708
streamer = say_stream()

docs/english/concepts/using-the-assistant-class.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
If you don't have a paid workspace for development, you can join the [Developer Program](https://api.slack.com/developer-program) and provision a sandbox with access to all Slack features for free.
55
:::
66

7-
The `Assistant` class can be used to handle the incoming events expected from a user interacting with an app in Slack that has the Agents & AI Apps feature enabled.
7+
The `Assistant` class can be used to handle the incoming events expected from a user interacting with an app in Slack that has the **Agents** feature enabled.
8+
9+
:::warning[The `Assistant` class targets the assistant messaging experience]
10+
The `Assistant` class handles the [assistant messaging experience](/ai/developing-agents) (`assistant_view`), in which agent conversations happen in separate Chat and History tabs. Apps going forward use the agent messaging experience (`agent_view`) by default, where conversations happen in the Messages tab and you handle events such as [`app_home_opened`](/reference/events/app_home_opened) and [`message.im`](/reference/events/message.im) directly. Refer to [Adding agent features](/tools/bolt-python/concepts/adding-agent-features) and the [agent messaging experience changelog entry](/changelog/2026/06/30/agent-messages-tab) for the default experience and migration guidance.
11+
:::
812

913
A typical flow would look like:
1014

@@ -58,7 +62,7 @@ If you do provide your own `threadContextStore` property, it must feature `find`
5862

5963
## Configuring your app to support the `Assistant` class {#configuring-assistant-class}
6064

61-
1. Within [App Settings](https://api.slack.com/apps), enable the **Agents & AI Apps** feature.
65+
1. Within [App Settings](https://api.slack.com/apps), enable the **Agents** feature.
6266

6367
2. Within the App Settings **OAuth & Permissions** page, add the following scopes:
6468
* [`assistant:write`](/reference/scopes/assistant.write)
@@ -326,4 +330,4 @@ def respond_to_bot_messages(logger: logging.Logger, set_status: SetStatus, say:
326330

327331
See the [_Creating agents: adding and handling feedback_](/tools/bolt-python/concepts/adding-agent-features#adding-and-handling-feedback) section for adding feedback buttons with Block Kit.
328332

329-
Want to see the functionality described throughout this guide in action? We've created a [App Agent Template](https://github.com/slack-samples/bolt-python-assistant-template) repo for you to build from.
333+
Want to see the functionality described throughout this guide in action? We've created a [Starter Agent Template](https://github.com/slack-samples/bolt-python-starter-agent) repo for you to build from.

0 commit comments

Comments
 (0)