AI 개발

AI Agent는 왜 Sandbox에서 돌려야 하나? 2026 NVIDIA OpenShell 런타임 경계와 MCP tools/call 아웃바운드

약 15분

모델은 JSON만 채운다. 위험한 것은 누가 실행하고, 디스크·소켓에 누가 닿는지이다. 2026 NVIDIA OpenShell은 openshell-sandbox 아래에서 agent를 돌린다. 생성 시 landlock·파일 정책을 고정하고, TOFU 바이너리 허용 목록 프록시로 아웃바운드하며, L7에서 protocol: mcp와 legacy json-rpc를 나눠 enforce한다. 이 글은 런타임 sandbox이며, 채팅 권한이나 Sentry 반복이 아니다.

읽기 전 요약

구성요소 OpenShell 사실(문서/PR) JSON에서 볼 것
openshell-sandbox agent 프로세스 수명 주기 감독; status 조회 가능 sandbox_id, state, supervisor
L7 아웃바운드 프록시 2026 정책이 앱 계층에서 MCP methods/tools/call과 json-rpc method 매칭 connections[].protocol, enforcement
TOFU 바이너리 등록된 바이너리만 아웃바운드 연결 proxy.binary_allowlist, matched_rule
Landlock / FS filesystem_policy·landlock은 sandbox 생성 시; 네트워크처럼 핫 리로드 안 됨 landlock.applied_at_create
json-rpc 배치 배치 한 건 deny면 전체 deny(MCP와 동일) 두 번째 hop legacy method 거부

사실 기준 2026-11-06: OpenShell 정책 문서, openshell-sandbox CLI, 2026 L7 MCP/json-rpc enforcement PR·릴리스 노트. 주문 A-1042·sb_agent_demo_7f3a는 가상. status JSON은 Diff용 예시이며 비공개 wire dump가 아님.

JSON은 커널도 아웃바운드 문도 아니다—sandbox가 필요하다

coding agent 루프는 같다. 모델이 tool_use를 내고 runtime이 실행한다. sandbox 없으면 잘못된 tool 이름이 임의 프로세스·경로·URL이 될 수 있다. OpenShell은 모델 밖에 세 층을 둔다:

  • 프로세스·파일: openshell-sandbox가 worker 기동; Landlock·filesystem_policy가 생성 시 트리 고정.
  • 아웃바운드 HTTP: 프록시가 endpoint protocol로 JSON-RPC 파싱—MCP tools/call vs legacy reports.search는 다른 규칙표.
  • 호스트는 인자 검증: 프록시는 기본적으로 arguments 미매칭; A-1042 형태는 Schema.

tool 이름 allow/deny·Sentry: OpenShell tool 이름과 Sentry. 이 글은 runtime만. 세션 allow/ask/deny는 harness 목록: coding agent 권한 모델. MCP 형태: coding agent MCP 호출. 루프·state: agent harness와 JSON state.

openshell-sandbox는 프로세스 감독, 채팅 권한이 아님

openshell-sandbox CLI(supervisor 이름은 status JSON에)가 worker를 격리에 넣는다. cgroup/네임스페이스, Landlock, 같은 sandbox에 붙은 egress 프록시. 모델 tool_use는 harness에서 승인; tools/call을 보내는 건 상자 안 Python·runner 바이너리. TOFU는 어떤 바이너리가 어떤 tool server에 닿는지 등록—모델 token 내용이 아님. network_policies는 핫 리로드; 파일·Landlock은 불가—디스크 권한 바꾸려면 sandbox 재생성. 2026 문서는 L7 enforcement: MCP endpoint에서 method·params.name; legacy json-rpc에서 top-level method(예 reports.search). 사설망·루프백·링크 로컬·클라우드 메타데이터는 기본 아웃바운드 allow 밖.

tool_use에서 egress까지: JSON 네 개

1. 모델 tool_use(harness). 이름·input은 strict/Schema; sandbox 미참여:

{
  "type": "tool_use",
  "id": "toolu_order_01",
  "name": "lookup_order",
  "input": {
    "order_id": "A-1042"
  }
}

2. 가상 sandbox status. tool server 연결, protocol, 마지막 egress 결정—정책 Diff용:

{
  "sandbox_id": "sb_agent_demo_7f3a",
  "state": "running",
  "supervisor": "openshell-sandbox",
  "created_at": "2026-11-06T08:12:04Z",
  "landlock": { "applied_at_create": true, "filesystem_policy": "orders_ro_v1" },
  "proxy": {
    "mode": "tofu",
    "binary_allowlist": ["/usr/bin/python3", "/opt/agent/runner"],
    "connections": [
      {
        "tool_server": "orders-mcp",
        "host": "orders.example.com",
        "port": 443,
        "path": "/mcp",
        "protocol": "mcp",
        "enforcement": "enforce",
        "status": "connected"
      },
      {
        "tool_server": "reports-legacy",
        "host": "reports.internal.example.com",
        "port": 8443,
        "path": "/rpc",
        "protocol": "json-rpc",
        "enforcement": "enforce",
        "status": "connected"
      }
    ]
  },
  "last_egress_decision": {
    "allowed": true,
    "method": "tools/call",
    "tool": "lookup_order",
    "matched_rule": "orders-mcp.tools/call.lookup_order"
  }
}

3. sandbox 프로세스의 MCP tools/call. 프록시는 L7에서 이 body를 읽음—모델 산문 아님:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "lookup_order",
    "arguments": { "order_id": "A-1042" }
  }
}

4. 같은 배치의 legacy json-rpc. reports.search가 rules에 없으면 배치 전체 deny:

[
  {
    "jsonrpc": "2.0",
    "id": "batch-1",
    "method": "tools/call",
    "params": {
      "name": "lookup_order",
      "arguments": { "order_id": "A-1042" }
    }
  },
  {
    "jsonrpc": "2.0",
    "id": "batch-2",
    "method": "reports.search",
    "params": {
      "query": "refund A-1042",
      "limit": 10
    }
  }
]

Sandbox, harness, tool 이름 정책, Schema—역할 분리

다 ‘보안’이라 불린다. 객체가 다르다. 섞으면 egress가 새거나 잘못된 세션 tool을 막는다:

문 보는 JSON/동작 흔한 실수
Harness allow/ask/deny 세션에서 Bash·Read·MCP 클라이언트 실행 여부 IDE에서 Shell 막았는데 runner가 미등록 orders host 접속
OpenShell runtime sandbox 상자 안 바이너리, Landlock, 프록시가 보는 outbound body Allow 한 번 눌렀지만 미등록 바이너리 egress
OpenShell tool 이름 정책 MCP tools/call params.name tool allow/deny는 OpenShell·Sentry 글—deny_rules는 여기서 반복 안 함
호스트 Schema tool_use.input·arguments tool 이름 허용인데 order_id garbage가 DB로

권한 파일은 세션: coding agent 권한 모델. 인자 문은 Schema: AI가 JSON Schema를 쓰는 이유. tool 이름·Sentry: OpenShell tool 이름과 Sentry.

감사 가능 sandbox에 agent 넣기—다섯 단계

network policy 넓히기 전 가상 주문 A-1042를 staging에서 통과:

  1. JSON 세 면을 분리 저장. messages tool_use, 호스트 state, OpenShell policy/sandbox status—한 blob 금지.
  2. 생성 시 filesystem+Landlock. 새 디렉터리면 재생성; 핫 리로드 기대 금지.
  3. TOFU 바이너리·tool server 등록. endpoint마다 protocol, host, port, path, enforcement: enforce.
  4. MCP·legacy endpoint 분리. 한 host:port에 protocol: mcp와 json-rpc 표 혼합 금지.
  5. 배치는 최악 hop 기준. lookup과 reports.search를 한 batch로 deny 시험 금지.

다섯 단계가 Diff 가능 JSON에 있으면 harness·프록시·Schema를 구분할 수 있다.

egress 실패 시 네 객체 펼치기

sandbox status last_egress_decision부터, policy와 실제 outbound body 대조.

  • tool_use·status·egress 포맷; arguments A-1042는 Schema 검증.
  • JSONPath 추출로 $.params.name, $.method, $.connections[*].protocol.
  • 핫 리로드 전후 policy JSON Diff; prompt보다 connections·deny_rules.
  • openshell logs --tail --source sandbox로 거부 binary·host·path.
  • 로그·status token 마스킹. JSONSort는 브라우저 로컬.

네 객체가 맞으면 binary 미등록, protocol 오류, legacy method 미허용 중 무엇인지 안다.

흔한 함정

  • allow/ask/deny를 sandbox로 착각. harness 세션 문. MCP egress는 OpenShell runtime 필요.
  • 모델 tool_use만 감사하고 sandbox egress body 무시. runner가 JSON-RPC 재작성·재전송 가능.
  • network_policies 핫 리로드가 Landlock도 바꾼다고 생각. 파일 정책은 생성 시 고정; 디스크 변경은 재생성.
  • MCP·legacy json-rpc 규칙표 공유. 2026 L7은 protocol 분기; 혼합 endpoint silent mismatch.
  • TOFU 바이너리 무시. interpreter 경로만 바꾸고 allowlist 미갱신 시 프록시에서 차단.
  • 이 글로 OpenShell·Sentry 글의 Sentry 심층 대체. 대역 밖 하드웨어는 runtime JSON만으로 설명 불가.

FAQ

OpenShell 없이 harness 권한만으로 충분한가?

아니다. 권한 파일은 IDE tool 문; sandbox는 프로세스 경로·어떤 바이너리가 어떤 host로 JSON-RPC 보내는지 문. 둘 다 필요.

sandbox가 tools/call의 order_id를 검증하나?

기본 아니오. L7 MCP는 method·tool 이름. 인자 형태는 호스트 Schema—OpenShell은 tool-argument matching 미지원.

legacy json-rpc와 MCP 차이?

endpoint protocol. MCP는 tools/call+params.name; legacy는 reports.search 같은 top method. 규칙 분리 작성.

JSON-RPC 배치 한 건 deny면?

MCP와 동일. 한 건 deny면 배치 전체 deny. lookup과 미허가 search 묶지 말 것.

Docker로 agent 돌리는 것과 같나?

컨테이너는 포장. OpenShell은 Landlock·바이너리별 L7 egress·openshell-sandbox lifecycle/status 추가. 컨테이너만으로 MCP tools/call 파싱 안 함.

결론

agent는 sandbox에서 돌아야 한다. tool JSON은 의도만 말하고 커널·디스크·egress는 아니다. OpenShell은 openshell-sandbox, Landlock, TOFU, L7 MCP/json-rpc 프록시로 실행을 Diff 가능 경계에 가둔다.

규칙 넓히기 전 tool_use, sandbox status, outbound tools/call, policy 정렬. 세션 권한·tool 이름·Schema는 각 글에서 읽고 하나의 allow 목록으로 합치지 말 것.

더 읽기

변경 이력: 초판