Skip to content

[Part 1] Create a new Persistent Sandbox Handle#382

Merged
k8s-ci-robot merged 2 commits intokubernetes-sigs:mainfrom
SHRUTI6991:refactor_client_prs
Mar 17, 2026
Merged

[Part 1] Create a new Persistent Sandbox Handle#382
k8s-ci-robot merged 2 commits intokubernetes-sigs:mainfrom
SHRUTI6991:refactor_client_prs

Conversation

@SHRUTI6991
Copy link
Contributor

@SHRUTI6991 SHRUTI6991 commented Mar 9, 2026

Working on #359

Description

This PR introduces the Resource Handle abstraction for the Python SDK. This is the first step in a multi-part refactor aimed at moving away from the current context-manager-centric design. A lot of the code is porting existing code into new classes.

The goal of this PR is to define the core classes and logic for managing Sandboxes as independent "handles." This allows for resource management that can persist beyond a single code block and provides a cleaner interface for future client-side updates.

Note: This PR does not affect the client yet

Key changes

  • New ResourceHandle Sandbox Class: Introduced a persistent handle for resource lifecycle management.
  • SandboxConnector: Connects, closes and sends request to server based on the connection config defined by the user
  • Namespaced engines: CommandExecutor and FileSystem: Explicit classes for execution based on the type.

Future Work

  • Update the Client to return these handles instead of using the legacy context manager.
  • Refactor existing integration examples (e.g., Pod Snapshot, LangChain, Computer Use) to consume the new Handle API.

Checklist

[x] I have performed a self-review of my own code.
[x] Logic is documented via docstrings for the new handle classes.
[x] Initial unit tests for Handle state transitions are included.

Full Demo

https://www.youtube.com/watch?v=khMLrf-vO9Y

@netlify
Copy link

netlify bot commented Mar 9, 2026

Deploy Preview for agent-sandbox canceled.

Name Link
🔨 Latest commit be96367
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/69b984fce9fb640008f1f915

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 9, 2026
@SHRUTI6991 SHRUTI6991 changed the title Implementation 1: Create a new Persistent Sandbox Handle. [Part 1] Create a new Persistent Sandbox Handle Mar 9, 2026
@SHRUTI6991
Copy link
Contributor Author

/assign @igooch

@SHRUTI6991 SHRUTI6991 force-pushed the refactor_client_prs branch from edd41c5 to 15cdd04 Compare March 13, 2026 19:12
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 13, 2026
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Mar 13, 2026

@SHRUTI6991: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
presubmit-agent-sandbox-lint-go 15cdd04 link true /test presubmit-agent-sandbox-lint-go

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 13, 2026
@SHRUTI6991 SHRUTI6991 force-pushed the refactor_client_prs branch from 15cdd04 to 3d8c33a Compare March 13, 2026 19:18
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 13, 2026
Copy link
Contributor

@igooch igooch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good.

Adding a note that we may need to update the pyproject.toml to pick up the new subdirectories when publishing the SDK.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 16, 2026
@SHRUTI6991 SHRUTI6991 force-pushed the refactor_client_prs branch from 28984da to 8981b8c Compare March 16, 2026 16:43
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 16, 2026
@SHRUTI6991
Copy link
Contributor Author

/assign @janetkuo

Copy link
Contributor

@igooch igooch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 17, 2026
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: igooch, SHRUTI6991

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 17, 2026
@SHRUTI6991
Copy link
Contributor Author

/unassign @janetkuo

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 17, 2026
@igooch
Copy link
Contributor

igooch commented Mar 17, 2026

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 17, 2026
@k8s-ci-robot k8s-ci-robot merged commit 749a1ce into kubernetes-sigs:main Mar 17, 2026
9 checks passed
nadolskit pushed a commit to nadolskit/agent-sandbox that referenced this pull request Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants