From 748ed1495bcca98ee9bbb43254a55bf610c20bba Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Tue, 14 Apr 2026 18:35:22 +0800 Subject: [PATCH] docs: add version requirement for event hooks in message event guide --- docs/en/dev/star/guides/listen-message-event.md | 8 ++++++++ docs/zh/dev/star/guides/listen-message-event.md | 8 ++++++++ docs/zh/dev/star/plugin.md | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/docs/en/dev/star/guides/listen-message-event.md b/docs/en/dev/star/guides/listen-message-event.md index aa02d8400..a789bb10f 100644 --- a/docs/en/dev/star/guides/listen-message-event.md +++ b/docs/en/dev/star/guides/listen-message-event.md @@ -291,6 +291,8 @@ async def on_llm_resp(self, event: AstrMessageEvent, resp: LLMResponse): # Note #### On Agent Begin +> Requires AstrBot version > v4.23.1 + When the Agent starts running, the `on_agent_begin` hook is triggered. ```python @@ -307,6 +309,8 @@ async def on_agent_begin(self, event: AstrMessageEvent, run_context: ContextWrap #### Before LLM Tool Call +> Requires AstrBot version > v4.23.1 + When the Agent is about to call an LLM tool, the `on_using_llm_tool` hook is triggered. You can obtain the `FunctionTool` object and tool call arguments. @@ -329,6 +333,8 @@ async def on_using_llm_tool( #### After LLM Tool Call +> Requires AstrBot version > v4.23.1 + After the LLM tool call completes, the `on_llm_tool_respond` hook is triggered. You can obtain the `FunctionTool` object, tool call arguments, and tool call result. @@ -354,6 +360,8 @@ async def on_llm_tool_respond( #### On Agent Done +> Requires AstrBot version > v4.23.1 + After the Agent finishes running, the `on_agent_done` hook is triggered. This hook is triggered after `on_llm_response`. ```python diff --git a/docs/zh/dev/star/guides/listen-message-event.md b/docs/zh/dev/star/guides/listen-message-event.md index 762be035d..35030869b 100644 --- a/docs/zh/dev/star/guides/listen-message-event.md +++ b/docs/zh/dev/star/guides/listen-message-event.md @@ -307,6 +307,8 @@ async def on_llm_resp(self, event: AstrMessageEvent, resp: LLMResponse): # 请 #### Agent 开始运行时 +> 适用于 AstrBot 版本 > v4.23.1 + 在 Agent 开始运行时,会触发 `on_agent_begin` 钩子。 ```python @@ -323,6 +325,8 @@ async def on_agent_begin(self, event: AstrMessageEvent, run_context: ContextWrap #### LLM 工具调用前 +> 适用于 AstrBot 版本 > v4.23.1 + 在 Agent 准备调用 LLM 工具时,会触发 `on_using_llm_tool` 钩子。 可以获取到 `FunctionTool` 对象和工具调用参数。 @@ -345,6 +349,8 @@ async def on_using_llm_tool( #### LLM 工具调用后 +> 适用于 AstrBot 版本 > v4.23.1 + 在 LLM 工具调用完成后,会触发 `on_llm_tool_respond` 钩子。 可以获取到 `FunctionTool` 对象、工具调用参数和工具调用结果。 @@ -370,6 +376,8 @@ async def on_llm_tool_respond( #### Agent 运行完成时 +> 适用于 AstrBot 版本 > v4.23.1 + 在 Agent 运行完成后,会触发 `on_agent_done` 钩子。这个钩子会在 `on_llm_response` 之后触发。本质上和 `on_llm_response` 一样。 ```python diff --git a/docs/zh/dev/star/plugin.md b/docs/zh/dev/star/plugin.md index a286e9250..b9077db64 100644 --- a/docs/zh/dev/star/plugin.md +++ b/docs/zh/dev/star/plugin.md @@ -509,6 +509,8 @@ async def on_llm_resp(self, event: AstrMessageEvent, resp: LLMResponse): # 请 ##### Agent 开始运行时 +> 适用于 AstrBot 版本 > v4.23.1 + 在 Agent 开始运行时,会触发 `on_agent_begin` 钩子。 ```python @@ -525,6 +527,8 @@ async def on_agent_begin(self, event: AstrMessageEvent, run_context: ContextWrap ##### LLM 工具调用前 +> 适用于 AstrBot 版本 > v4.23.1 + 在 Agent 准备调用 LLM 工具时,会触发 `on_using_llm_tool` 钩子。 可以获取到 `FunctionTool` 对象和工具调用参数。 @@ -547,6 +551,8 @@ async def on_using_llm_tool( ##### LLM 工具调用后 +> 适用于 AstrBot 版本 > v4.23.1 + 在 LLM 工具调用完成后,会触发 `on_llm_tool_respond` 钩子。 可以获取到 `FunctionTool` 对象、工具调用参数和工具调用结果。 @@ -572,6 +578,8 @@ async def on_llm_tool_respond( ##### Agent 运行完成时 +> 适用于 AstrBot 版本 > v4.23.1 + 在 Agent 运行完成后,会触发 `on_agent_done` 钩子。这个钩子会在 `on_llm_response` 之后触发。 可以获取到 `LLMResponse` 对象,可以对其进行修改。