1- # pytest: unit , qualitative, ollama, e2e
1+ # pytest: e2e , qualitative
22"""Example usage patterns for bash_executor and local_bash_executor tools.
33
44Demonstrates multiple ways to use Mellea's bash execution capabilities:
1010Safety note: bash_executor uses Docker isolation via llm-sandbox (recommended
1111for production). local_bash_executor runs commands directly (for dev/testing only).
1212Both 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
1617from mellea import MelleaSession , start_session
@@ -100,7 +101,7 @@ def example_3_llm_with_forced_tool_use(m: MelleaSession) -> None:
100101
101102
102103def 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