chore: update examples to use opencode

This commit is contained in:
Nathan Flurry 2026-02-25 02:29:45 -08:00
parent c3a95c3611
commit 57eb329f9a
3 changed files with 9 additions and 16 deletions

View file

@ -1,5 +1,4 @@
FROM node:22-bookworm-slim
RUN apt-get update && apt-get install -y curl ca-certificates && rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://releases.rivet.dev/sandbox-agent/0.2.x/install.sh | sh
RUN sandbox-agent install-agent claude
RUN sandbox-agent install-agent codex
RUN sandbox-agent install-agent opencode

View file

@ -8,16 +8,13 @@ def detect_agent() -> str:
"""Pick an agent based on env vars. Exits if no credentials are found."""
if os.environ.get("SANDBOX_AGENT"):
return os.environ["SANDBOX_AGENT"]
has_claude = bool(
has_anthropic = bool(
os.environ.get("ANTHROPIC_API_KEY")
or os.environ.get("CLAUDE_API_KEY")
or os.environ.get("CLAUDE_CODE_OAUTH_TOKEN")
)
has_codex = (os.environ.get("OPENAI_API_KEY") or "").startswith("sk-")
if has_codex:
return "codex"
if has_claude:
return "claude"
has_openai = bool(os.environ.get("OPENAI_API_KEY"))
if has_anthropic or has_openai:
return "opencode"
print("No API keys found. Set ANTHROPIC_API_KEY or OPENAI_API_KEY.")
sys.exit(1)

View file

@ -8,16 +8,13 @@ def detect_agent() -> str:
"""Pick an agent based on env vars. Exits if no credentials are found."""
if os.environ.get("SANDBOX_AGENT"):
return os.environ["SANDBOX_AGENT"]
has_claude = bool(
has_anthropic = bool(
os.environ.get("ANTHROPIC_API_KEY")
or os.environ.get("CLAUDE_API_KEY")
or os.environ.get("CLAUDE_CODE_OAUTH_TOKEN")
)
has_codex = (os.environ.get("OPENAI_API_KEY") or "").startswith("sk-")
if has_codex:
return "codex"
if has_claude:
return "claude"
has_openai = bool(os.environ.get("OPENAI_API_KEY"))
if has_anthropic or has_openai:
return "opencode"
print("No API keys found. Set ANTHROPIC_API_KEY or OPENAI_API_KEY.")
sys.exit(1)