Skip to content

feat(sandbox): implement standalone sandbox runtimes - #2960

Closed
EItanya wants to merge 12 commits into
mainfrom
feat/sandbox-e2e
Closed

EItanya wants to merge 12 commits into
mainfrom
feat/sandbox-e2e

Conversation

@EItanya

@EItanya EItanya commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

This PR implements standalone sandboxes so users and agents can create a scratch environment from a SandboxTemplate, run commands, move files, and suspend, resume, or delete it.

Stacked on #2959; this PR targets feat/sandbox-apis.

  • Prepare pinned Substrate runtimes through KRT and run the env guest with a durable workspace.
  • Share runtime revision and instance persistence through Session and Sandbox extensions, and move Sessions onto the shared lifecycle enums.
  • Execute lifecycle mutations inline with client retries. Expiration remains automatic, and sandbox suspension can interrupt running processes or transfers.
  • Expose lifecycle and upstream env process/file services through the apiserver, plus tools on the existing MCP endpoint. Include ownership checks, Helm configuration, and architecture and retry documentation.

The schema changes are folded into the initial migration for pre-alpha and require a fresh database. The commit stack also isolates the UI corrections for explicit Agent routing.

Validation: core tests, PostgreSQL store and migration tests (including inline SQL preparation), in-process guest/gRPC/MCP tests, protobuf generation, and lint passed. Intermediate implementation commits compile independently. Live-cluster E2E tests were added but were not rerun for the latest lifecycle changes or commit split.

@github-actions github-actions Bot added the enhancement New feature or request label Sep 26, 2026
@EItanya
EItanya marked this pull request as ready for review September 26, 2026 21:12
@EItanya
EItanya added this pull request to stack #2961 September 26, 2026 21:15
@EItanya
EItanya force-pushed the feat/sandbox-e2e branch 2 times, most recently from 63814c6 to 3032b0e Compare September 26, 2026 22:06
Base automatically changed from feat/sandbox-apis to main September 26, 2026 22:28
EItanya added a commit that referenced this pull request Sep 26, 2026
This PR adds API contracts for standalone sandboxes that users and
agents can use as scratch environments.

- Add the `SandboxTemplate` CRD and catalog service, including
validation, generated CRDs, and Kubernetes clients. Templates remain
independent of `Harness`.
- Add `SandboxService` lifecycle contracts and shared `RuntimeState` /
`RuntimeOperation` enums.
- Reuse the upstream env process and filesystem contracts, with
`kagent-sandbox-id` metadata identifying the target sandbox.

This is the first of two stacked PRs. Service registration, runtime
behavior, and Session adoption of the shared enums follow in #2960,
which is stacked on this branch.

Validation: `go test ./api/... ./core/...` passed, including PostgreSQL
and CRD validation tests. `make proto-check` and `make proto-breaking`
passed with no generated drift.

---------

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Sep 26, 2026
Move Sessions onto RuntimeState and RuntimeOperation and update Go, SQL, CLI, and UI consumers together. Preserve enum field numbers and keep the mechanical rename separate from runtime storage and workflow changes.

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Persist prepared revisions and runtime instances with Session and Sandbox extensions in the initial schema. Share typed operation claims and Substrate transitions, bound each inline attempt, and allow clients to retry interrupted work. Keep full resource protobufs and document retry behavior.

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Prepare pinned SandboxTemplate revisions through KRT and provide owner-authorized inline lifecycle, expiration, process, and file operations. Initialize the guest workspace before readiness and cover runtime and preparation failure paths.

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Register catalog, lifecycle, and upstream env services in the apiserver, route guest requests by sandbox metadata, and expose the same operations through MCP. Wire preparation, expiration, default guest configuration, Helm permissions, and authenticated MCP identity propagation. Add in-process transport and authorization coverage.

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Preserve the UI corrections carried by the sandbox branch after the Agent/Session API rebase. Pass Agent routing references when reading history, invoking agents, and forking conversations, and use the Session conversation ID consistently.

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Cover lifecycle retries, guest processes and files, durable state, expiration, authorization, and agent-owned MCP sandboxes. Document the shipped API, runtime boundaries, and deferred asset preparation and egress work.

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
@EItanya EItanya closed this Sep 26, 2026
alexdarbyshire pushed a commit to alexdarbyshire/kagent that referenced this pull request Oct 5, 2026
This PR adds API contracts for standalone sandboxes that users and
agents can use as scratch environments.

- Add the `SandboxTemplate` CRD and catalog service, including
validation, generated CRDs, and Kubernetes clients. Templates remain
independent of `Harness`.
- Add `SandboxService` lifecycle contracts and shared `RuntimeState` /
`RuntimeOperation` enums.
- Reuse the upstream env process and filesystem contracts, with
`kagent-sandbox-id` metadata identifying the target sandbox.

This is the first of two stacked PRs. Service registration, runtime
behavior, and Session adoption of the shared enums follow in kagent-dev#2960,
which is stacked on this branch.

Validation: `go test ./api/... ./core/...` passed, including PostgreSQL
and CRD validation tests. `make proto-check` and `make proto-breaking`
passed with no generated drift.

---------

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant