Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/strands_tools/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"HOME",
"BYPASS_TOOL_CONSENT",
"STRANDS_NON_INTERACTIVE",
"STRANDS_DISABLE_LOAD_TOOL",
}


Expand Down
20 changes: 20 additions & 0 deletions tests/test_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,26 @@ def test_direct_delete_protected_var(agent, os_environment):
assert os_environment["PATH"] == unchanging_value


def test_set_load_tool_control_var_refused(agent, os_environment):
"""Test that setting the dynamic-tool-loading control variable is refused."""
os_environment["STRANDS_DISABLE_LOAD_TOOL"] = "true"

result = agent.tool.environment(action="set", name="STRANDS_DISABLE_LOAD_TOOL", value="false")
assert result["status"] == "error"
# Verify the control variable was not changed
assert os_environment["STRANDS_DISABLE_LOAD_TOOL"] == "true"


def test_delete_load_tool_control_var_refused(agent, os_environment):
"""Test that deleting the dynamic-tool-loading control variable is refused."""
os_environment["STRANDS_DISABLE_LOAD_TOOL"] = "true"

result = agent.tool.environment(action="delete", name="STRANDS_DISABLE_LOAD_TOOL")
assert result["status"] == "error"
# Verify the control variable still exists
assert os_environment["STRANDS_DISABLE_LOAD_TOOL"] == "true"


def test_direct_delete_var_cancelled(agent, os_environment):
"""Test cancelling deletion of an environment variable."""
var_name = "CANCEL_DELETE_VAR"
Expand Down
Loading