import asyncio async def bash(command: str, sandbox=None) -> str: """ Execute a bash command in the sandbox. Args: command: Shell command to run sandbox: PodmanSandbox instance Returns: Command output (stdout + stderr) """ if sandbox is None: return "Error: Sandbox not available" try: result = await asyncio.to_thread(sandbox.run, command) return result except RuntimeError as e: return f"Error: sandbox execution failed: {e}" except Exception as e: return f"Error: Unexpected failure: {e}" BASH_SCHEMA = { "name": "bash", "description": "Execute a bash command in the isolated sandbox environment. Use this to run shell commands, install packages, run scripts, etc.", "input_schema": { "type": "object", "properties": { "command": { "type": "string", "description": "The bash command to execute (e.g., 'ls -la', 'python script.py', 'pip install requests')", } }, "required": ["command"], }, }