Repository navigation
feat(sandbox): add a kosa8 Cloud sandbox provider - #754
Merged
Merged
Conversation
Adds kosa8 as a built-in VM sandbox provider, `kosa8`. It needs no extra: it drives kosa8 Cloud's REST API with httpx. Each sandbox is a microVM booted with docker: true from kosa8's universal Ubuntu 24.04 image, so agent-env's docker-in-VM flows run unchanged; exposed ports are public previews, egress allow lists are enforced on the host, and get_sandbox restores both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The allow list now goes with the create, so kosa8 enforces it before the create answers and the VM never runs more open than asked; a create kosa8 refuses for its allow list (an egress error code, or 501) is a policy it can't enforce, so a fallback chain moves on. The PUT after boot, and the API call behind it, are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kosa8 compiles an org's deny list into `block:…`, or `;deny:…` after an allow list, which a NetworkPolicy can't carry; read as allow-all, it let the sandbox try to curl a signed URL kosa8's host blocks, failing the load instead of pushing the bytes over exec. The sandbox now keeps the denied entries beside its policy, from the create and from a reconnect, and downloads only from a host its policy allows and nothing denies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
kosa8, a built-in VM sandbox provider for kosa8 Cloud. Each env and each agent gets its own kosa8 microVM, booted with Docker inside and a public HTTPS preview URL per exposed port, so the docker-in-VM flows run unchanged: the gateway's docker-compose, an agent'sdocker run, image loading and artifact collection.This is @drvt69talati's branch from #737. Their commit is kept as is, with their authorship, and two commits of mine follow it. Closes #737.
How it fits the other providers
It follows
agent37, the other provider with no extra:providers/sandbox_providers/kosa8/(provider.py,sandbox.py,README.md).httpx, so there's no new extra and nouv.lockchange._BUILTIN_SANDBOX_PROVIDERS, and the rootAGENTS.mdprovider lists, the CLI--sandboxhelp,config.example.tomlandtst/util/capabilities.pyeach name it.FACTORIESinnetwork_policy_stamping_test.py, a row inprovider_capabilities_test.py, its tunnel domain inegress_hosts_test.py, and config tests intest_config_sandbox_providers.py;skip_without_remote_sandbox("kosa8"), as the other remote providers are.[sandbox.providers.kosa8.config](api_key = "env:..."or"secret:..."), never fromos.environ. TLS is always verified. Unknown config keys are refused.What it does, as the sandbox-provider guide's checklist asks:
create_vm,get_sandboxand aVmSandbox;create_sandboxwrapscreate_vm, as boxd's does.imageis refused before anything is created.boot_modeandenvare logged and ignored.NetworkPolicyUnsupportedError; IPv6 entries, or more than 256, are refused before any call.agentenv-<random>name and deleted.ttl_sbacks both.get_sandboxfrom a fresh provider restores the preview URLs and the egress policy kosa8 enforces.terminateis idempotent, and a gone sandbox raisesSandboxNotFoundError.My change on top
The contributor's version applied the egress allowlist with a
PUT …/egressonce the VM was running. kosa8 Cloud's create call takes the same allowlist (egress: {"allow": [...]}), and its docs say "the policy is in force before the create answers". If the host can't apply it, the sandbox is deleted and the create fails. So the allowlist now goes with the create, and a restricted sandbox never runs unrestricted.A create kosa8 refuses because of its allowlist is raised as
NetworkPolicyUnsupportedError, so a fallback chain moves on. That covers an egress error code such as403 egress_not_allowed, and a501. Any other refusal is raised as it is. ThePUTand its API method are gone, and the README says the policy is applied at create.A second fix, from review: kosa8 compiles an organization's deny rules into its enforced policy, either a
block:…list or a;deny:…part after an allow list, andNetworkPolicycan't hold either. Read as allow-all, a sandbox would try tocurla signed URL that kosa8's host blocks, and the load would fail instead of pushing the bytes over exec. The sandbox now keeps the denied entries beside itsnetwork_policy, from the create and fromget_sandbox, and downloads only from a host its policy allows and nothing denies.Verification
ruff check .: passes.kosa8_sandbox_provider_test.py,kosa8_sandbox_test.py,egress_hosts_test.py,network_policy_stamping_test.py,provider_capabilities_test.py,test_config_sandbox_providers.py,tst/unit/test_capabilities.py): all pass. The one skip is the existingsmolextra, whichdevleaves out.kosa8cases: the smoke test, the WebSocket test, the gateway tests and the task-step e2e.check_plugin_api.pywith this title: no break to the plugin surface.Not run here: anything against a real kosa8 organization. kosa8 Cloud has no free tier, and CI uses no outside credentials, so its live tests skip with
agentenv-capability-missing: remote_sandbox. @drvt69talati, could you run these on your org against this branch and paste the output?Docs
The website's provider pages should cover:
kosa8and its config table:api_key,base_url,regionandimage;*.wildcards and IPv4 entries, applied at create;The provider's own
README.mdhas all of this.🤖 Generated with Claude Code


Confidence Score: 5/5
The follow-up appears safe to merge; the earlier file-loading issue is fixed.Summary
Adds
kosa8as a built-in cloud sandbox provider with Docker-capable VMs. The follow-up fixes file loading when an organization's network rules block a download host.The previous finding is addressed. No new actionable issues were found in the follow-up changes.
Reviews (5) · Last reviewed commit: "fix(sandbox): a kosa8 sandbox pushes a f..." · Reviewed by Greptile