mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-05 01:48:44 +00:00
feat(tools): expose tool_step_description hook for streamed step text
The response_stream log extension hardcoded one tool name to build the step label beside a streamed call. The label now comes from build_step_description, which seeds the generic text from the humanized tool name (underscores as spaces) and dispatches a display-only tool_step_description hook plugins rewrite, with the compact serialized args length appended centrally after the chain so argument streaming stays visible. Validation: pytest tests/test_tool_step_description.py (14 passed), tests/test_plain_response_logging.py (18 passed), tests/test_response_stream_cadence.py (3 passed)
This commit is contained in:
1 parent
b389813736
commit
e4b79fb5c5
6 files changed
+216
-25
No files matched your search
+20
@@ -0,0 +1,20 @@
|
||||
from helpers.extension import Extension
|
||||
|
||||
|
||||
class CodeExecutionStep(Extension):
|
||||
def execute(self, ctx: dict | None = None, **kwargs) -> None:
|
||||
if not isinstance(ctx, dict) or ctx.get("tool_name") != "code_execution_tool":
|
||||
return
|
||||
args = ctx.get("tool_args")
|
||||
if not isinstance(args, dict) or "runtime" not in args:
|
||||
return
|
||||
code = args.get("code")
|
||||
if isinstance(code, str):
|
||||
ctx["step"] = "Writing code..."
|
||||
runtime = args["runtime"]
|
||||
if runtime == "python":
|
||||
ctx["step"] = "Writing Python code..."
|
||||
elif runtime == "nodejs":
|
||||
ctx["step"] = "Writing Node.js code..."
|
||||
elif runtime == "terminal":
|
||||
ctx["step"] = "Writing terminal command..."
|
||||
Reference in new issue
Block a user