|
1 | | -from typing import TYPE_CHECKING, Optional |
| 1 | +from typing import Optional |
2 | 2 |
|
3 | 3 | from slack_sdk.web.async_client import AsyncWebClient |
4 | 4 |
|
|
15 | 15 | from slack_bolt.context.set_title.async_set_title import AsyncSetTitle |
16 | 16 | from slack_bolt.util.utils import create_copy |
17 | 17 |
|
18 | | -if TYPE_CHECKING: |
19 | | - from slack_bolt.agent.async_agent import AsyncBoltAgent |
20 | | - |
21 | 18 |
|
22 | 19 | class AsyncBoltContext(BaseContext): |
23 | 20 | """Context object associated with a request from Slack.""" |
@@ -190,36 +187,6 @@ async def handle_button_clicks(context): |
190 | 187 | self["fail"] = AsyncFail(client=self.client, function_execution_id=self.function_execution_id) |
191 | 188 | return self["fail"] |
192 | 189 |
|
193 | | - @property |
194 | | - def agent(self) -> "AsyncBoltAgent": |
195 | | - """`agent` listener argument for building AI-powered Slack agents. |
196 | | -
|
197 | | - Experimental: |
198 | | - This API is experimental and may change in future releases. |
199 | | -
|
200 | | - @app.event("app_mention") |
201 | | - async def handle_mention(agent): |
202 | | - stream = await agent.chat_stream() |
203 | | - await stream.append(markdown_text="Hello!") |
204 | | - await stream.stop() |
205 | | -
|
206 | | - Returns: |
207 | | - `AsyncBoltAgent` instance |
208 | | - """ |
209 | | - if "agent" not in self: |
210 | | - # Deferred import: AsyncBoltAgent is only imported at runtime when accessed, |
211 | | - # avoiding unnecessary loading when the agent property is never used. |
212 | | - from slack_bolt.agent.async_agent import AsyncBoltAgent |
213 | | - |
214 | | - self["agent"] = AsyncBoltAgent( |
215 | | - client=self.client, |
216 | | - channel_id=self.channel_id, |
217 | | - thread_ts=self.thread_ts, |
218 | | - team_id=self.team_id, |
219 | | - user_id=self.user_id, |
220 | | - ) |
221 | | - return self["agent"] |
222 | | - |
223 | 190 | @property |
224 | 191 | def set_title(self) -> Optional[AsyncSetTitle]: |
225 | 192 | return self.get("set_title") |
|
0 commit comments