Skip to content

Commit a1cabdc

Browse files
committed
review comments
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
1 parent dfd2b8b commit a1cabdc

3 files changed

Lines changed: 311 additions & 196 deletions

File tree

docs/examples/tools/shell_example.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# pytest: unit, qualitative, ollama, e2e
1+
# pytest: e2e, qualitative
22
"""Example usage patterns for bash_executor and local_bash_executor tools.
33
44
Demonstrates multiple ways to use Mellea's bash execution capabilities:
@@ -10,7 +10,8 @@
1010
Safety note: bash_executor uses Docker isolation via llm-sandbox (recommended
1111
for production). local_bash_executor runs commands directly (for dev/testing only).
1212
Both enforce a conservative safety denylist: no sudo, no rm -rf, no destructive
13-
git operations, no writes to /etc, /sys, /proc, etc.
13+
git operations, no writes to /etc, /sys, /proc, etc. Write operations can also
14+
be constrained with ``working_dir`` and explicit ``allowed_paths``.
1415
"""
1516

1617
from mellea import MelleaSession, start_session
@@ -100,7 +101,7 @@ def example_3_llm_with_forced_tool_use(m: MelleaSession) -> None:
100101

101102

102103
def example_3_with_working_dir() -> None:
103-
"""Example 3: Restrict command execution to a specific directory."""
104+
"""Example 3: Restrict write validation and execution cwd to a directory."""
104105
print("=== Example 3: Working Directory Restriction ===")
105106

106107
import tempfile
@@ -122,7 +123,7 @@ def example_3_with_working_dir() -> None:
122123
print(f"Output: {result.stdout}")
123124
print()
124125

125-
# Attempt to write outside working directory (will be rejected)
126+
# Attempt to write outside the restricted working directory (will be rejected)
126127
result = local_bash_executor(
127128
"echo 'bad' > /tmp/outside.txt", working_dir=tmpdir
128129
)

0 commit comments

Comments
 (0)