Add Kruise Sandbox deployer feature#442
Conversation
Summary of ChangesHello @bcfre, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the deployment capabilities by introducing native support for Kruise Sandbox. This new deployer allows AI agents to leverage Kubernetes-native sandbox management, providing features like resource pooling, rapid provisioning, and sandbox hibernation. The integration includes a dedicated Kubernetes client, a deployment manager, and command-line interface tools, making it straightforward for users to deploy and manage their AI agents in isolated and secure environments on Kubernetes clusters. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a significant new feature: a deployer for Kruise Sandbox. The changes are comprehensive, including the core SandboxDeployManager and SandboxClient, a new agentscope deploy sandbox CLI command, extensive documentation, and a full working example. The overall implementation is solid and follows existing patterns in the codebase. My review focuses on improving consistency, fixing a broken example, and addressing a potential security concern with a hardcoded URL in the example code.
1b3c940 to
2f4e6f5
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a new Sandbox deployer feature that enables deploying AI agents as Kruise Sandbox custom resources (agents.kruise.io/v1alpha1) on Kubernetes. The implementation integrates with the existing AgentScope Runtime deployment framework, providing a production-ready solution for deploying agents with instance-level isolation and pause/resume capabilities.
Changes:
- Adds
SandboxClientfor Kubernetes Sandbox CRD operations (create, delete, status polling, Service management) - Adds
SandboxDeployManagerfor orchestrating image builds, Sandbox CR creation, and Service exposure - Integrates new deployer into CLI commands (
agentscope deploy sandboxandagentscope stop --platform sandbox) - Includes comprehensive unit tests with 675 lines covering creation, deployment, lifecycle management, and edge cases
- Provides example scripts demonstrating deployment patterns with detailed configuration
- Updates English and Chinese documentation with deployment guides and usage examples
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
src/agentscope_runtime/common/container_clients/sandbox_client.py |
New Kubernetes client for Sandbox CRD operations with full CRUD support |
src/agentscope_runtime/engine/deployers/sandbox_deployer.py |
Main deployment manager integrating image build, CR creation, and Service management |
src/agentscope_runtime/cli/commands/deploy.py |
CLI command for sandbox deployment with comprehensive options |
src/agentscope_runtime/cli/commands/stop.py |
CLI command extension for stopping sandbox deployments |
tests/deploy/test_sandbox_deployer.py |
Comprehensive test suite with 675 lines covering all deployment scenarios |
examples/deployments/sandbox_deploy/app_deploy_to_sandbox.py |
Example script demonstrating programmatic deployment |
examples/deployments/sandbox_deploy/sandbox_deploy_config.yaml |
YAML configuration example |
examples/deployments/sandbox_deploy/sandbox_deploy_config.json |
JSON configuration example |
examples/deployments/sandbox_deploy/README.md |
Detailed usage guide with prerequisites and troubleshooting |
cookbook/en/advanced_deployment.md |
English documentation for sandbox deployment |
cookbook/zh/advanced_deployment.md |
Chinese documentation for sandbox deployment |
cookbook/en/cli.md |
English CLI reference for sandbox commands |
cookbook/zh/cli.md |
Chinese CLI reference for sandbox commands |
| Integration files | Updates to __init__.py files for proper module exports |
01a40b0 to
c4aab5b
Compare
357da3d to
4d6b025
Compare
7711eaf to
a92465b
Compare
|
@all-contributors please add @bcfre for code, doc |
|
I've put up a pull request to add @bcfre! 🎉 |
Description
[Describe what this PR does and why]
OpenKruise Agents is a CNCF sub-project under OpenKruise that provides Kubernetes-native sandbox management for AI agent workloads. It offers vendor-neutral sandboxes with features like resource pooling, rapid provisioning, sandbox hibernation, and comprehensive API/SDK support.
This PR adds a new
sandboxdeployer that enables deploying AI agents as Kruise Sandbox custom resources on Kubernetes. Users can deploy agents via CLI withagentscope deploy sandbox, and the platform handles image building, Sandbox CR creation, Service exposure, and lifecycle management automatically.Changes include:
SandboxClient: Kubernetes client for Sandbox CRD (CRUD operations, status polling, Service management)SandboxDeployManager: Deploy manager integrating image build, Sandbox CR creation, and Service exposureagentscope deploy sandboxandagentscope stop --platform sandboxRelated Issue: Fixes #[issue_number] or Relates to #[issue_number]
Security Considerations: [If applicable, especially for sandbox changes]
Type of Change
Component(s) Affected
Checklist
Testing
[How to test these changes]
Additional Notes
[Optional: any other context]