Files
PaperClipAI/packages/plugins/sandbox-providers/createos/README.md
T
a8d32e5e61 feat(sandbox-providers): add CreateOS sandbox provider (#13434)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Agent work runs in sandboxes that provider plugins supply
> - Operators can choose a provider to run agent work
> - CreateOS adds another provider with workspace-preserving pause and
resume
> - This pull request adds a CreateOS provider plugin
> - The benefit is that operators can preserve a workspace between runs
without keeping its compute active

## Linked Issues or Issue Description

Refs #13203 and the earlier closed #13096.

This continues the CreateOS contribution from @bhautikchudasama and
@ashwaq06. The branch preserves the original implementation commit.
Thank you to both contributors.

When squash-merging, preserve the original author's credit in the squash
commit body:

```text
Co-Authored-By: bhautikchudasama <BhautikChudasama@users.noreply.github.com>
```

The original fork rejects maintainer pushes. This branch includes the
merge-conflict resolution and review fixes. The request is described
below using `adapter_request.yml`.

**Agent or provider**

CreateOS sandbox API (https://api.sb.createos.sh).

**Why this adapter is useful**

CreateOS can pause a sandbox and resume it by ID. The workspace survives
the pause. This adds a reusable-lease option to the existing sandbox
provider system.

**How the agent is invoked**

Build and install the local plugin as described in its README. Open
Instance Settings, then Environments. Select the `createos` driver.
Supply an API key and shape. The driver then supplies sandbox leases for
agent runs.

**Are you willing to implement it?**

Yes. This pull request is the implementation.

## What Changed

- Adds the `createos` sandbox provider under
`packages/plugins/sandbox-providers/createos`.
- Calls the CreateOS HTTP API directly. The package adds no vendor SDK.
- Implements the environment lifecycle hooks, incremental process
output, and binary workspace sync.
- Registers the optional bundled provider and its trusted host
credential fallback. The fallback is limited to the official API origin;
custom endpoints require an explicit key.
- Lists the package in the release manifest with `publishFromCi: false`
until its first npm publish is bootstrapped.
- Waits through delayed pause/resume state updates without duplicate
action requests.
- Cancels queued API requests promptly while preserving request spacing.
- Uses direct CLI invocation in the setup guide so paths and IDs are
passed without an extra shell expansion.
- Includes current master and retains its existing Git-subfolder
containment fix.

## Demo

Fresh setup and a run against a CreateOS sandbox.


https://github.com/user-attachments/assets/e71b9e06-c006-4fb9-b847-52dfd68f6110


https://github.com/user-attachments/assets/43b5ac75-66bd-4f76-8563-67e4c7759084

## Verification

All 25 jobs in [CI run
34884260542](https://github.com/paperclipai/paperclip/actions/runs/34884260542)
passed at commit `f8d0997677024b784fdadf9d44a84c01cb4e813c`, including
typecheck, build, native runner verification, server and workspace
tests, browser tests, and the canary release dry run. Greptile reviewed
the same commit at 5/5 with no unresolved review threads.

GitHub reports no merge conflicts. The remaining merge gate is
code-owner approval for the new `package.json`, as required by
`.github/CODEOWNERS` and the `master` ruleset. Reviewers have been
requested automatically.

Local checks passed:

- Provider: `pnpm typecheck`, `pnpm test` (52 passed, one live smoke
skipped), and `pnpm build`.
- Host: focused credential and bundled-plugin tests (17 passed), plus
CLI invocation safety (39 passed).
- Release: package manifest check and release policy tests (18 passed).

The full local `pnpm test:run` attempt caught the README command issue;
its focused rerun now passes. The full local run stopped after its
general-server group: 7,804 tests passed, with unrelated embedded
PostgreSQL startup failures and 10 failures in unchanged
runtime-skill-cache tests (`EACCES` on directory rename on macOS). It
did not reach the later test groups. Local `pnpm -r typecheck` and `pnpm
build` reach the runner package and stop because this machine has no
Rust/Cargo installation. The corresponding CI checks passed on
provisioned runners, as linked above.

The live CreateOS smoke requires explicit provider credentials and was
not run during this review. It is available with `CREATEOS_LIVE_TEST=1
pnpm test` in the provider directory. The author supplied the demo links
above.

## Risks

The provider is opt-in and is not installed by default. It is available
through a local-path install or explicit image inclusion. npm
publication remains disabled until a maintainer bootstraps the package
and enables publishing.

Sandbox creation has no idempotency key. An ambiguous create response
can leave a resource that requires provider-account inspection. Process
tracking is in memory; durable lease recovery belongs to the host. The
provider does not advertise guaranteed expiry, interactive login,
snapshots, duplex channels, or ingress. Live native-runner qualification
remains outside this PR's tested claims.

## Model Used

Original provider implementation: human-authored by @bhautikchudasama,
as reported in #13203. The original description reports Claude Opus 5
assistance.

Review and follow-up fixes: OpenAI GPT-6 via Codex, with code review,
editing, and tool execution. The precise runtime model variant and
context-window size are not exposed in this session.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass (focused checks; full-suite
environment limits documented above)
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: bhautikchudasama <bhautikrchudasama@gmail.com>
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-09-15 17:09:43 -07:00

7.4 KiB

@paperclipai/plugin-createos

CreateOS sandbox provider for Paperclip. This package lives alongside Daytona and E2B, outside the root pnpm workspace, and uses CreateOS's public HTTP API. No CreateOS SDK dependency is required; the tar library handles local archives. The package has not been published as part of this change; use a local-path install for development. Its release manifest entry has publishFromCi: false until a maintainer bootstraps the first npm publish and enables CI publishing.

Build and install locally

Requires Node 24.11+, pnpm, and an installed Paperclip checkout.

cd packages/plugins/sandbox-providers/createos
pnpm install --ignore-workspace --no-lockfile
pnpm typecheck
pnpm test
pnpm build

From the Paperclip checkout, with your instance running:

node cli/node_modules/tsx/dist/cli.mjs cli/src/index.ts plugin install /absolute/path/to/paperclip/packages/plugins/sandbox-providers/createos
node cli/node_modules/tsx/dist/cli.mjs cli/src/index.ts plugin list
node cli/node_modules/tsx/dist/cli.mjs cli/src/index.ts plugin inspect paperclip.createos-sandbox-provider

Rebuild after source changes; local plugin output watching reloads the worker. If the running worker still uses the previous build, explicitly reload it when no sandbox commands are active:

node cli/node_modules/tsx/dist/cli.mjs cli/src/index.ts plugin disable paperclip.createos-sandbox-provider
node cli/node_modules/tsx/dist/cli.mjs cli/src/index.ts plugin enable paperclip.createos-sandbox-provider

The plugin uses the same package entrypoints and publish manifest helper as other sandbox providers. Plugin workers are trusted code on the Paperclip host.

Configure an environment

Configure the provider under Instance Settings → Environments. The plugin has no custom UI. Required fields:

  • apiUrl: defaults to https://api.sb.createos.sh. A trailing /v1 is accepted and normalized. HTTPS is required except on loopback for testing.
  • shape: choose from the dropdown of published CreateOS shapes. The bundled choices match https://api.sb.createos.sh/v1/shapes as of 2026-09-08.
  • apiKey: your CreateOS key. Paperclip saves pasted keys as company secrets; a resolved environment key takes precedence over the optional host fallback CREATEOS_API_KEY for https://api.sb.createos.sh only. Custom API endpoints, including loopback fixtures, require an explicit environment key. The host forwards this fallback only to the trusted CreateOS package installed from the repository or bundled plugin catalog (or from the first-party npm scope after publication). Other local plugin paths must use an environment-configured key.

Optional fields:

  • rootfs: a rootfs catalog entry or a ready template ID/name; omission uses the provider default. The image must include /bin/bash, ordinary Unix utilities including tar, base64, and GNU realpath (-m support), and the selected adapter's runtime dependencies (such as Node and Git). The generic runtime provisions/stages agent assets; this plugin does not build an agent image.
  • region: must match the API endpoint. Omission uses the provider default.
  • timeoutMs: operation/default command deadline, 300000 ms by default. This is not a sandbox TTL.
  • reuseLease: default false. False deletes on release; true waits for pause completion and later resumes the same sandbox, preserving workspace data.

The probe creates a sandbox, prepares its workspace, executes a managed command, and deletes the sandbox. It therefore uses real provider resources.

Implemented behavior

  • Company/environment-bound lease metadata and a random workspace marker checked before a resumed lease is trusted. API keys are not lease metadata.
  • State-aware pause/resume with bounded polling. Transient errors are surfaced; only missing/terminal sandboxes or a mismatched workspace expire a resume.
  • Managed pipe processes with explicit working directory, quoted arguments, per-command environment, staged stdin, and separate stdout/stderr. Per-command variables are applied by the command wrapper; CreateOS's API-level environment overrides only accept keys declared at sandbox creation.
  • Incremental output via replayable NDJSON, bounded reconnect attempts, UTF-8 decoding across frame boundaries, and explicit errors for missing output. Returned stdout/stderr each retain at most 4 Mi characters of tail output; metadata.outputTruncated reports truncation. Live log chunks are still delivered as they arrive.
  • API requests to each endpoint are spaced by at least 300 ms across this worker's leases, keeping callback polling below the provider's 300/minute IP limit. Other workers or applications sharing the same IP can still exhaust that shared limit.
  • Command timeout and active lease-release/shutdown cancellation explicitly terminate the process tree. Disconnecting the stream alone is not cancellation. Unknown process-creation outcomes and failed process cleanup prevent reuse in the current worker; the operator/host must destroy the affected lease. No automatic retry of process creation or command execution occurs.
  • Workspace realization at /paperclip-workspace and native binary file sync, including directory archives, file modes, exclusions, symlink containment, atomic file downloads, and ordered post-upload commands. This keeps bulk data out of CreateOS's 1 MiB managed-process output journal. Ordinary command output still uses that journal and fails explicitly if unread data is evicted. Outbound archives are validated before extraction and limited to 10 GiB of declared file data; absolute/traversing paths and escaping links are rejected.

Capability boundaries

Interactive login PTYs, temporary login leases, snapshot capture, duplex channels, and provider WebSocket ingress are not advertised. CreateOS idle auto-pause is not a guaranteed absolute expiry, so acquisition with requestedExpiresAt fails before provisioning a resource.

The host has an outbound-WSS native runner path for providers without ingress. Using it additionally requires a reachable Paperclip runner endpoint and the host's qualified runner/provider artifacts. This plugin's local tests do not constitute an end-to-end native runner qualification.

Sandbox create has no idempotency key in the inspected API. If its response is lost before an ID arrives, the plugin cannot identify that resource for cleanup; inspect the provider account before retrying an ambiguous creation. A plugin crash also loses its in-memory command tracking; durable lease recovery remains host-owned. This version does not claim a provider-side expiration guarantee.

Opt-in live smoke

Default tests use mocked HTTP responses and do not contact CreateOS. To test a chosen endpoint, export CREATEOS_API_URL, CREATEOS_API_KEY, CREATEOS_SHAPE, and optionally CREATEOS_ROOTFS, then run:

CREATEOS_LIVE_TEST=1 pnpm test

The live test creates a sandbox, round-trips a 5 MiB binary file through native sync, checks stdin/env/output, writes a file, pauses and resumes the sandbox, verifies the file, and deletes it in finally. It does not print credentials. Cleanup errors fail the test.

Optional managed-image inclusion

The bundled catalog key is createos. Include the createos directory in the Docker CLOUD_BUNDLED_PLUGINS build argument, then include createos in the managed configuration's plugins.autoInstall list. Adding the catalog entry does not auto-install the plugin or change the default image contents.