> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ko/llms.txt # 작업공간샌드박스 **추가된 항목:** `@mastra/core@1.1.0` `WorkspaceSandbox` 인터페이스는 Workspace가 명령을 실행하고 백그라운드 프로세스를 관리하는 방식을 정의합니다. ## 속성 **processes** (`SandboxProcessManager`): 백그라운드 프로세스 관리자입니다. 구현하지 않으면 프로세스 관리 Tool을 사용할 수 없습니다. SandboxProcessManager 레퍼런스를 참조하세요. ## 행동 양식 ### `start()` Sandbox를 시작합니다. `workspace.init()` 또는 첫 번째 `executeCommand()` 호출 시 자동으로 호출됩니다. ```typescript await sandbox.start() ``` 이 메서드는 명령 실행을 위해 샌드박스를 준비합니다. ### `stop()` 샌드박스를 중지합니다. ```typescript await sandbox.stop?.() ``` ### `destroy()` 샌드박스 리소스를 정리합니다. 호출자`workspace.destroy()`. ```typescript await sandbox.destroy() ``` ### `executeCommand(command, args?, options?)` 쉘 명령을 실행합니다. ```typescript const result = await sandbox.executeCommand('ls', ['-la', '/docs']) const result = await sandbox.executeCommand('npm', ['install', 'lodash']) ``` **매개변수:** **command** (`string`): 실행할 명령 **args** (`string[]`): 명령 인수 **options** (`Options`): 구성 옵션입니다. **options.timeout** (`number`): 실행 제한 시간(밀리초) **options.cwd** (`string`): 명령의 작업 디렉터리 **options.env** (`Record`): 추가 환경 변수 **options.onStdout** (`(data: string) => void`): stdout 스트리밍 콜백 **options.onStderr** (`(data: string) => void`): stderr 스트리밍 콜백 ### `getInfo()` 샌드박스 상태 및 리소스 정보를 가져옵니다. ```typescript const info = await sandbox.getInfo() // { status: 'running', resources: { memoryMB: 512, cpuPercent: 5 } } ``` ### `getInstructions(opts?)` 이 샌드박스의 작동 방식에 대한 설명을 반환합니다. 작업 영역이 Agent에 할당될 때 Agent의 시스템 메시지에 삽입됩니다. ```typescript const instructions = sandbox.getInstructions?.() // 'Local command execution. Working directory: "/workspace".' ``` **매개변수:** **opts.requestContext** (`RequestContext`): 생성자에서 instructions 함수를 제공한 경우 해당 함수로 전달됩니다. **보고:** `string` ## 관련된 - [SandboxProcessManager 참조](https://mastra.zisheng.pro/ko/reference/workspace/process-manager) - [모래 상자](https://mastra.zisheng.pro/ko/docs/workspace/sandbox) - [작업공간 클래스](https://mastra.zisheng.pro/ko/reference/workspace/workspace-class) - [파일 시스템 인터페이스](https://mastra.zisheng.pro/ko/reference/workspace/filesystem)