File size: 807 Bytes
ad8ba8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from src.infrastructure.tools.registry import tool_registry
from src.infrastructure.sandbox.docker_manager import docker_sandbox

async def shell_execute(session_id: str, command: str) -> str:
    """Execute a shell command in the sandbox"""
    if not docker_sandbox:
        return "Error: Sandbox unavailable"
    return await docker_sandbox.execute_shell(session_id, command)

tool_registry.register(
    name="shell_execute",
    description="Execute a shell command in the sandbox",
    parameters={
        "type": "OBJECT",
        "properties": {
            "session_id": {"type": "STRING", "description": "The session ID"},
            "command": {"type": "STRING", "description": "The command to execute"}
        },
        "required": ["session_id", "command"]
    },
    func=shell_execute
)