fix: address review feedback on tool registration gating
This commit is contained in:
@@ -195,7 +195,6 @@ def register_tool(
|
|||||||
requires_web_search_mode: bool = False,
|
requires_web_search_mode: bool = False,
|
||||||
) -> Callable[..., Any]:
|
) -> Callable[..., Any]:
|
||||||
def decorator(f: Callable[..., Any]) -> Callable[..., Any]:
|
def decorator(f: Callable[..., Any]) -> Callable[..., Any]:
|
||||||
sandbox_mode = _is_sandbox_mode()
|
|
||||||
if not _should_register_tool(
|
if not _should_register_tool(
|
||||||
sandbox_execution=sandbox_execution,
|
sandbox_execution=sandbox_execution,
|
||||||
requires_browser_mode=requires_browser_mode,
|
requires_browser_mode=requires_browser_mode,
|
||||||
@@ -203,6 +202,7 @@ def register_tool(
|
|||||||
):
|
):
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
sandbox_mode = _is_sandbox_mode()
|
||||||
func_dict = {
|
func_dict = {
|
||||||
"name": f.__name__,
|
"name": f.__name__,
|
||||||
"function": f,
|
"function": f,
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ def test_sandbox_registers_sandbox_tools_but_not_non_sandbox_tools(
|
|||||||
assert "web_search" not in names
|
assert "web_search" not in names
|
||||||
|
|
||||||
|
|
||||||
def test_load_skill_does_not_register_agents_graph_when_imported_directly(
|
def test_load_skill_import_does_not_register_create_agent_in_sandbox(
|
||||||
monkeypatch: Any,
|
monkeypatch: Any,
|
||||||
) -> None:
|
) -> None:
|
||||||
monkeypatch.setenv("STRIX_SANDBOX_MODE", "true")
|
monkeypatch.setenv("STRIX_SANDBOX_MODE", "true")
|
||||||
@@ -75,7 +75,6 @@ def test_load_skill_does_not_register_agents_graph_when_imported_directly(
|
|||||||
registry = importlib.import_module("strix.tools.registry")
|
registry = importlib.import_module("strix.tools.registry")
|
||||||
|
|
||||||
names_before = set(registry.get_tool_names())
|
names_before = set(registry.get_tool_names())
|
||||||
assert "python_action" in names_before
|
|
||||||
assert "load_skill" not in names_before
|
assert "load_skill" not in names_before
|
||||||
assert "create_agent" not in names_before
|
assert "create_agent" not in names_before
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user