Skip to content

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

fix(agent): separate the logic of the arguments `enable_meta_tool` and `plan_notebook` (#880)

Zheng Dayu7f83c1eda397
diff --git a/src/agentscope/agent/_react_agent.py b/src/agentscope/agent/_react_agent.py
index f221b1f2a..07cbd3605 100644
--- a/src/agentscope/agent/_react_agent.py
+++ b/src/agentscope/agent/_react_agent.py
@@ -225,15 +225,24 @@ class ReActAgent(ReActAgentBase):
self.plan_notebook = None
if plan_notebook:
self.plan_notebook = plan_notebook
- self.toolkit.create_tool_group(
- "plan_related",
- description=self.plan_notebook.description,
- )
- for tool in plan_notebook.list_tools():
- self.toolkit.register_tool_function(
- tool,
- group_name="plan_related",
+ # When enable_meta_tool is True, plan tools are in plan_related
+ # group and active by agent.
+ # Otherwise, plan tools in bassic group and always active.
+ if enable_meta_tool:
+ self.toolkit.create_tool_group(
+ "plan_related",
+ description=self.plan_notebook.description,
)
+ for tool in plan_notebook.list_tools():
+ self.toolkit.register_tool_function(
+ tool,
+ group_name="plan_related",
+ )
+ else:
+ for tool in plan_notebook.list_tools():
+ self.toolkit.register_tool_function(
+ tool,
+ )
# If print the reasoning hint messages
self.print_hint_msg = print_hint_msg