Skip to content

Commit 404e85c

Browse files
authored
Merge pull request #2316 from charlieyangs/patch-1
Fix the bug in has_builder_tools
2 parents a32f86d + d183880 commit 404e85c

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

backend/core/run/prompt_manager.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,18 @@ async def _append_builder_tools_prompt(system_content: str, agent_config: Option
127127
return system_content
128128

129129
agentpress_tools = agent_config.get('agentpress_tools', {})
130-
has_builder_tools = any(
131-
agentpress_tools.get(tool, False)
132-
for tool in ['agent_config_tool', 'mcp_search_tool', 'credential_profile_tool', 'trigger_tool']
133-
)
130+
131+
def is_tool_enabled(tool_name: str) -> bool:
132+
tool_config = agentpress_tools.get(tool_name)
133+
if isinstance(tool_config, bool):
134+
return tool_config
135+
elif isinstance(tool_config, dict):
136+
return tool_config.get('enabled', False)
137+
else:
138+
return False
139+
140+
builder_tool_names = ['agent_creation_tool', 'agent_config_tool', 'mcp_search_tool', 'credential_profile_tool', 'trigger_tool']
141+
has_builder_tools = any(is_tool_enabled(tool) for tool in builder_tool_names)
134142

135143
if has_builder_tools:
136144
builder_prompt = get_agent_builder_prompt()

0 commit comments

Comments
 (0)