0b7fc29ac4
Co-authored-by: Dt8333 <25431943+Dt8333@users.noreply.github.com> Co-authored-by: Soulter <905617992@qq.com>
33 lines
875 B
Python
33 lines
875 B
Python
from dataclasses import dataclass
|
|
from typing import Generic
|
|
|
|
import mcp
|
|
|
|
from astrbot.core.agent.tool import FunctionTool
|
|
from astrbot.core.provider.entities import LLMResponse
|
|
|
|
from .run_context import ContextWrapper, TContext
|
|
|
|
|
|
@dataclass
|
|
class BaseAgentRunHooks(Generic[TContext]):
|
|
async def on_agent_begin(self, run_context: ContextWrapper[TContext]): ...
|
|
async def on_tool_start(
|
|
self,
|
|
run_context: ContextWrapper[TContext],
|
|
tool: FunctionTool,
|
|
tool_args: dict | None,
|
|
): ...
|
|
async def on_tool_end(
|
|
self,
|
|
run_context: ContextWrapper[TContext],
|
|
tool: FunctionTool,
|
|
tool_args: dict | None,
|
|
tool_result: mcp.types.CallToolResult | None,
|
|
): ...
|
|
async def on_agent_done(
|
|
self,
|
|
run_context: ContextWrapper[TContext],
|
|
llm_response: LLMResponse,
|
|
): ...
|