Refa: add result to callback for agent tool use. (#9137)

### What problem does this PR solve?


### Type of change

- [x] Refactoring
This commit is contained in:
Kevin Hu
2025-08-01 21:49:39 +08:00
committed by GitHub
parent c5823a33a3
commit a16cd4f110
26 changed files with 10875 additions and 897 deletions

View File

@ -49,11 +49,12 @@ class LLMToolPluginCallSession(ToolCallSession):
def tool_call(self, name: str, arguments: dict[str, Any]) -> Any:
assert name in self.tools_map, f"LLM tool {name} does not exist"
self.callback(name, arguments, " running ...")
if isinstance(self.tools_map[name], MCPToolCallSession):
resp = self.tools_map[name].tool_call(name, arguments, 60)
else:
resp = self.tools_map[name].invoke(**arguments)
self.callback(name, arguments, resp)
return resp
def get_tool_obj(self, name):