Agent CLI

Hiver ships the popular agent CLIs, each in a ready-to-run image. Pick one, provision its image, pass the right credential as an env var, and drive it with exec (one-shot) or execStream (live output).

Run Claude Code inside a sandbox. The claude image ships the CLI ready to go.

One-shot task

claude -p runs a single prompt non-interactively and prints the result. Use exec when you just need the final output.

index.ts
import { getOrCreateSandbox } from "@hiver.sh/client";

const sandbox = await getOrCreateSandbox("claude", {
image: "claude",
env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY! },
});

const result = await sandbox.exec(["claude", "-p", "Fix the bug in src/main.ts"], {
cwd: "/workspace",
});
console.log(result.stdout);

The key is injected once at creation and is immutable, every later exec on this sandbox inherits it automatically, so you never pass it again.

Using your Claude subscription

Instead of billing an ANTHROPIC_API_KEY, you can authenticate Claude Code with your Claude Pro or Max subscription. Start the sandbox without a key, then log in interactively from a shell:

hiver start claude-agent --image claude   # no API key needed
hiver shell claude-agent                   # then run `claude` and complete the browser login

The login is stored in the sandbox, so subsequent commands reuse it:

hiver shell claude-agent --command "claude -p 'what skills do you have?'"

Streaming output

Agents can run for a while and produce a lot of output. Use execStream to see stdout and stderr as they happen instead of waiting for the process to finish.

index.ts
const proc = await sandbox.execStream(["claude", "-p", "Refactor the auth module"], {
  cwd: "/workspace",
});

for await (const chunk of proc.pipes) {
  if (chunk.stdout) process.stdout.write(chunk.stdout);
  if (chunk.stderr) process.stderr.write(chunk.stderr);
}

console.log("exit code:", await proc.exitCode);

Interactive TUI

The quickest way to drive Claude Code's full-screen interface is hiver shell, which drops you into the sandbox with a live PTY attached:

hiver shell claude-agent   # then run `claude` for the interactive TUI

To build the same experience into your own tool, attach over a PTY yourself, see Pseudo Terminals for a complete example.

i
Keep secrets out of the agent's reach: rather than giving Claude your third-party API keys, allow the hosts it needs and inject credentials with an egress override, the agent uses them without ever seeing them.

Next: Claude Agent SDK