mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-21 00:04:53 +00:00
chore: update examples to use opencode
This commit is contained in:
parent
c3a95c3611
commit
57eb329f9a
3 changed files with 9 additions and 16 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
FROM node:22-bookworm-slim
|
FROM node:22-bookworm-slim
|
||||||
RUN apt-get update && apt-get install -y curl ca-certificates && rm -rf /var/lib/apt/lists/*
|
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 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 opencode
|
||||||
RUN sandbox-agent install-agent codex
|
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,13 @@ def detect_agent() -> str:
|
||||||
"""Pick an agent based on env vars. Exits if no credentials are found."""
|
"""Pick an agent based on env vars. Exits if no credentials are found."""
|
||||||
if os.environ.get("SANDBOX_AGENT"):
|
if os.environ.get("SANDBOX_AGENT"):
|
||||||
return os.environ["SANDBOX_AGENT"]
|
return os.environ["SANDBOX_AGENT"]
|
||||||
has_claude = bool(
|
has_anthropic = bool(
|
||||||
os.environ.get("ANTHROPIC_API_KEY")
|
os.environ.get("ANTHROPIC_API_KEY")
|
||||||
or os.environ.get("CLAUDE_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-")
|
has_openai = bool(os.environ.get("OPENAI_API_KEY"))
|
||||||
if has_codex:
|
if has_anthropic or has_openai:
|
||||||
return "codex"
|
return "opencode"
|
||||||
if has_claude:
|
|
||||||
return "claude"
|
|
||||||
print("No API keys found. Set ANTHROPIC_API_KEY or OPENAI_API_KEY.")
|
print("No API keys found. Set ANTHROPIC_API_KEY or OPENAI_API_KEY.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,13 @@ def detect_agent() -> str:
|
||||||
"""Pick an agent based on env vars. Exits if no credentials are found."""
|
"""Pick an agent based on env vars. Exits if no credentials are found."""
|
||||||
if os.environ.get("SANDBOX_AGENT"):
|
if os.environ.get("SANDBOX_AGENT"):
|
||||||
return os.environ["SANDBOX_AGENT"]
|
return os.environ["SANDBOX_AGENT"]
|
||||||
has_claude = bool(
|
has_anthropic = bool(
|
||||||
os.environ.get("ANTHROPIC_API_KEY")
|
os.environ.get("ANTHROPIC_API_KEY")
|
||||||
or os.environ.get("CLAUDE_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-")
|
has_openai = bool(os.environ.get("OPENAI_API_KEY"))
|
||||||
if has_codex:
|
if has_anthropic or has_openai:
|
||||||
return "codex"
|
return "opencode"
|
||||||
if has_claude:
|
|
||||||
return "claude"
|
|
||||||
print("No API keys found. Set ANTHROPIC_API_KEY or OPENAI_API_KEY.")
|
print("No API keys found. Set ANTHROPIC_API_KEY or OPENAI_API_KEY.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue