Skip to content

Comments

feat(clients/ts): add TypeScript SDK for Sandbox management#300

Open
khirotaka wants to merge 10 commits intokubernetes-sigs:mainfrom
khirotaka:main
Open

feat(clients/ts): add TypeScript SDK for Sandbox management#300
khirotaka wants to merge 10 commits intokubernetes-sigs:mainfrom
khirotaka:main

Conversation

@khirotaka
Copy link

Summary

  • Add TypeScript client library (clients/typescript/agentic-sandbox-client/) ported from the existing Python SDK
  • Implement core SandboxClient with full lifecycle management: start(), close(), run(), write(), read()
  • Add ComputerUseSandbox extension with agent() method for agentic task execution
  • Add optional OpenTelemetry tracing support with dynamic imports and trace context propagation
  • Add unit tests (vitest) for SandboxClient and ComputerUseSandbox
  • Add end-to-end tests covering router/gateway modes with and without warm pools

Details

TypeScript SDK (clients/typescript/agentic-sandbox-client/)

The SDK provides the same capabilities as the Python client:

  • SandboxClient: Creates a SandboxClaim, watches for Sandbox readiness, and establishes connectivity (direct API, gateway, or kubectl port-forward). Supports command execution,
    file upload/download, and automatic cleanup.
  • ComputerUseSandbox: Extension that adds an agent(query) endpoint for natural language agentic tasks (defaults to port 8080).
  • TracerManager: Optional OpenTelemetry integration using dynamic imports for tree-shakability. Injects trace context into SandboxClaim annotations.

E2E Tests (test/e2e/clients/typescript/)

Four test scenarios exercising the SDK against a real cluster:

  1. Router mode without warm pool
  2. Router mode with warm pool
  3. Gateway mode without warm pool
  4. Gateway mode with warm pool

Each scenario validates start()run()write()read()close() flow.

Test Plan

  • Unit tests pass (vitest in clients/typescript/agentic-sandbox-client/)
  • E2E tests pass against a Kind cluster (make test-e2e)
    • Router mode without warm pool (10s)
    • Router mode with warm pool (10s)
    • Gateway mode without warm pool (15s)
    • Gateway mode with warm pool (20s)

- Implement E2E test suite using Vitest
- Add TestContext framework for K8s resource management and wait conditions
- Port test scenarios from Python (Router/Gateway modes with/without WarmPool)
- Integrate TypeScript E2E tests into dev/tools/test-e2e script
- Add unit tests for SandboxClient and ComputerUse extension using Vitest
- Mock Kubernetes API, fetch, and port-forwarding logic for isolated testing
- Update package.json with test scripts, metadata, and exports configuration
- Enhance pod name discovery logic validation in tests
- Use absolute paths in E2E tests for better reliability across different working directories
- Fix Kubeconfig and manifest path resolution using import.meta.url
- Update package-lock.json with resolved peer dependency flags
…ration

- Standardize OpenTelemetry API import logic and add it as a dev dependency
- Add null-safety with default values for execution results in ComputerUse extension
- Add debug logging for fetch retry attempts in SandboxClient
- Ensure non-zero exit code on E2E test failures in dev/tools/test-e2e
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: khirotaka
Once this PR has been reviewed and has the lgtm label, please assign janetkuo for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@netlify
Copy link

netlify bot commented Feb 8, 2026

Deploy Preview for agent-sandbox canceled.

Name Link
🔨 Latest commit 18b2908
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/698d040d1918830008e83b3e

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 8, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: khirotaka / name: Hirotaka Kawashima (18b2908)

@k8s-ci-robot
Copy link
Contributor

Welcome @khirotaka!

It looks like this is your first PR to kubernetes-sigs/agent-sandbox 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/agent-sandbox has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @khirotaka. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 8, 2026
@janetkuo janetkuo added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 9, 2026
@khirotaka
Copy link
Author

/test presubmit-agent-sandbox-e2e-test

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 11, 2026
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants