Skip to content

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

[HOTFIX] Fix the bug in ReActAgent class (#788)

DavdGao77eefc2218d8
diff --git a/examples/functionality/plan/main_agent_managed_plan.py b/examples/functionality/plan/main_agent_managed_plan.py
index 1ef61a4c7..8bb327857 100644
--- a/examples/functionality/plan/main_agent_managed_plan.py
+++ b/examples/functionality/plan/main_agent_managed_plan.py
@@ -20,10 +20,6 @@ from agentscope.tool import (
async def main() -> None:
"""The main entry point for the plan example."""
- import agentscope
-
- agentscope.init(studio_url="http://localhost:3000")
-
toolkit = Toolkit()
toolkit.register_tool_function(execute_shell_command)
toolkit.register_tool_function(execute_python_code)
diff --git a/examples/react_agent/main.py b/examples/react_agent/main.py
index 31cef52bd..ea3506a1d 100644
--- a/examples/react_agent/main.py
+++ b/examples/react_agent/main.py
@@ -17,9 +17,6 @@ from agentscope.tool import (
async def main() -> None:
"""The main entry point for the ReAct agent example."""
- import agentscope
-
- agentscope.init(tracing_url="")
toolkit = Toolkit()
toolkit.register_tool_function(execute_shell_command)
toolkit.register_tool_function(execute_python_code)
diff --git a/src/agentscope/_version.py b/src/agentscope/_version.py
index 1e49881c2..07e89b319 100644
--- a/src/agentscope/_version.py
+++ b/src/agentscope/_version.py
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
"""The version of agentscope."""
-__version__ = "1.0.3"
+__version__ = "1.0.4dev"
diff --git a/src/agentscope/agent/_react_agent.py b/src/agentscope/agent/_react_agent.py
index f731d13d1..24dd2820b 100644
--- a/src/agentscope/agent/_react_agent.py
+++ b/src/agentscope/agent/_react_agent.py
@@ -451,11 +451,13 @@ class ReActAgent(ReActAgentBase):
await self.print(tool_res_msg, chunk.is_last)
# Return message if generate_response is called successfully
- if tool_call[
- "name"
- ] == self.finish_function_name and chunk.metadata.get(
- "success",
- True,
+ if (
+ tool_call["name"] == self.finish_function_name
+ and chunk.metadata
+ and chunk.metadata.get(
+ "success",
+ True,
+ )
):
response_msg = chunk.metadata.get("response_msg")