Skip to content

Build and run agents you can see, understand and trust.

feat(toolkit): add `original_name` field in `RegisteredToolFunction` class (#1028)

qbc80714633e275
diff --git a/src/agentscope/tool/_toolkit.py b/src/agentscope/tool/_toolkit.py
index 60abbb1c1..13e499172 100644
--- a/src/agentscope/tool/_toolkit.py
+++ b/src/agentscope/tool/_toolkit.py
@@ -425,6 +425,7 @@ Check "{dir}/SKILL.md" for how to use this skill"""
)
# Replace the function name with the new one
+ func_obj.original_name = func_name
func_obj.name = new_func_name
func_obj.json_schema["function"]["name"] = new_func_name
diff --git a/src/agentscope/tool/_types.py b/src/agentscope/tool/_types.py
index 4c7cef8a8..7d8a52d54 100644
--- a/src/agentscope/tool/_types.py
+++ b/src/agentscope/tool/_types.py
@@ -31,6 +31,8 @@ class RegisteredToolFunction:
)
"""The preset keyword arguments, which won't be presented in the JSON
schema and exposed to the user."""
+ original_name: str | None = None
+ """The original name of the tool function when it has been renamed."""
extended_model: Type[BaseModel] | None = None
"""The base model used to extend the JSON schema of the original tool
function, so that we can dynamically adjust the tool function."""