Skip to content

feat: add opsen as a sandbox provider - #258

Open
md322613 wants to merge 1 commit into
superagent-ai:mainfrom
md322613:add-opsen-sandbox
Open

md322613 wants to merge 1 commit into
superagent-ai:mainfrom
md322613:add-opsen-sandbox

Conversation

@md322613

@md322613 md322613 commented Sep 8, 2026

Copy link
Copy Markdown

Adds @vibe-kit/opsen, following the structure of packages/e2b.

opsen runs agent sandboxes and proxies their model calls, so machine, model and tool spend land under one task id.

const vibeKit = new VibeKit()
  .withAgent({ type: "grok", provider: "xai", apiKey: process.env.XAI_API_KEY! })
  .withSandbox(createOpsenProvider({
    apiKey: process.env.OPSEN_API_KEY!,
    taskId: "code-review",
    budgetUsd: 2.0,
  }));

Why another provider. Every sandbox in the current list bills for the machine and leaves the model bill with a different vendor — VibeKit's agent config takes a separate model provider and API key, so a team running Grok on a sandbox holds two bills with no shared identifier. Here instance.cost() returns machine, model and tool spend under one task id, and budgetUsd is a ceiling enforced mid-run rather than a number found on an invoice.

Agent attribution. VibeKit runs grok, claude, codex, gemini and opencode through one provider, so agentType is written as a label at session creation. "Which agent cost what" is only answerable if it is recorded when the session starts.

Interface. Implements SandboxProvider and SandboxInstance, with the interfaces declared locally as the other providers do. Typechecks clean against the published @opsendev/opsen client.

One limitation, stated plainly. getHost(port) depends on the runtime underneath. It works on E2B, works on Modal when the port was declared at sandbox creation, and throws with a message naming the limitation where unavailable, rather than returning a URL that does not answer.

Also adds docs/supported-sandboxes/opsen.mdx and its docs.json nav entry, following e2b.mdx.

Happy to restructure to match house conventions.

@homanp

homanp commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

@md322613 thanks for the PR, will have a look

@md322613

md322613 commented Sep 9, 2026

Copy link
Copy Markdown
Author

Anything I can do to move this along? Happy to rebase, split it up, or adjust to conventions I have missed.

If workspace sandbox providers are not something you are taking right now, that is a fine answer and I would rather know than leave it open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants