Skip to main content
Once a Claude runtime can reach Anthropic (Get started), treat claude as a worker: your app or CI submits a prompt, Claude edits files inside the sandbox, and you collect stdout / artifacts.

Prerequisites

Reuse an Identity provider + network policy from get-started, or create them inline as below.

Permission model

For unattended runs:
Auto-approval is contained by the Gravix microVM. Keep network allowlists tight and cap timeout on every run_cmd / runtime exec. The Claude template sets IS_SANDBOX=1 so bypass mode is allowed.

Minimal driver

Prefer command= + args= so user-supplied prompts cannot break shell quoting.

Structured JSON + session resume

--output-format json returns machine-readable output including session_id. Keep the same runtime and pass --resume for follow-ups.

Streaming events (stream-json)

Use Claude’s stream-json format with Gravix Layer’s on_stdout callback (SSE under the hood). The SDK still returns aggregated stdout / exit_code.
CLI streaming:

Patterns

Next