Skip to content

Add runtime api design proposal#44

Merged
volcano-sh-bot merged 3 commits intovolcano-sh:mainfrom
hzxuzhonghu:agent-code-runtime
Nov 28, 2025
Merged

Add runtime api design proposal#44
volcano-sh-bot merged 3 commits intovolcano-sh:mainfrom
hzxuzhonghu:agent-code-runtime

Conversation

@hzxuzhonghu
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings November 27, 2025 04:00
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @hzxuzhonghu, 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 introduces a comprehensive design proposal for a declarative API to manage Agent and CodeInterpreter runtimes within the AgentCube platform. The core objective is to provide developers with a robust mechanism to define and control the desired state of their sandboxes, facilitating automatic provisioning upon initial invocation. This new API aims to overcome the limitations of generic sandbox templates by offering specialized configurations and lifecycle management tailored to the unique requirements of agent and code interpreter environments.

Highlights

  • Declarative API Design: Introduces a new declarative API for managing Agent and CodeInterpreter runtimes in AgentCube, allowing users to define desired sandbox states for automatic creation upon first invocation.
  • Dedicated Runtime CRDs: Defines new Custom Resource Definitions (CRDs) including AgentRuntime, AgentEndpoint, CodeInterpreterRuntime, and CodeInterpreterEndpoint, specifically tailored for agent and code interpreter sandboxes.
  • Enhanced Sandbox Configuration: Enables detailed specification of runtime configurations such as exposed ports, session timeouts, maximum session durations, and for CodeInterpreter runtimes, warm pool sizes and specific sandbox template details like RuntimeClassName and container images.
  • Addressing Generic Template Limitations: Provides a rationale for moving beyond existing generic SandboxTemplate by highlighting its limitations for multi-version runtimes and distinct configuration needs, such as warm pools for code interpreters.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a design proposal for AgentRuntime and CodeInterpreterRuntime CRDs, along with their Go type definitions. The proposal is well-detailed and provides a solid foundation for the new APIs. My review focuses on addressing several inconsistencies between the design document and the Go code, correcting API definitions, and suggesting improvements for clarity and robustness. Key feedback points include removing non-standard JSON tags, aligning field requirements and naming conventions across the documentation and code, and ensuring that critical fields have appropriate validation.

metav1.TypeMeta `json:",inline"`
// metadata is a standard object metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty,omitzero" protobuf:"bytes,1,opt,name=metadata"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The omitzero tag is not a standard Go json tag and will be ignored by encoding/json. It should be removed to avoid confusion and adhere to standard practices.

Suggested change
metav1.ObjectMeta `json:"metadata,omitempty,omitzero" protobuf:"bytes,1,opt,name=metadata"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

RuntimeClassName *string `json:"runtimeClassName,omitempty" protobuf:"bytes,3,opt,name=runtimeClassName"`

// Image indicates the container image to use for the code interpreter runtime.
Image string `json:"image,omitempty" protobuf:"bytes,4,opt,name=image"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The Image field is fundamental for a container runtime, yet it's marked with omitempty and lacks a +kubebuilder:validation:Required annotation. This field should be mandatory to prevent invalid configurations.

Suggested change
Image string `json:"image,omitempty" protobuf:"bytes,4,opt,name=image"`
Image string `json:"image" protobuf:"bytes,4,opt,name=image"`

metav1.TypeMeta `json:",inline"`
// metadata is a standard object metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty,omitzero" protobuf:"bytes,1,opt,name=metadata"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The omitzero tag is not a standard Go json tag and will be ignored by encoding/json. It should be removed to avoid confusion. This comment applies to all CRD definitions in this proposal where omitzero is used.

Suggested change
metav1.ObjectMeta `json:"metadata,omitempty,omitzero" protobuf:"bytes,1,opt,name=metadata"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

Comment on lines +122 to +123
DefaultVersion string `json:"defaultVersion"`
Versions map[string]string `json:"versions"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The DefaultVersion and Versions fields in AgentRuntimeStatus are missing the omitempty JSON tag. This is inconsistent with CodeInterpreterRuntimeStatus (lines 301 and 307). It's a good practice to use omitempty for status fields to prevent them from being serialized when empty.

Suggested change
DefaultVersion string `json:"defaultVersion"`
Versions map[string]string `json:"versions"`
DefaultVersion string `json:"defaultVersion,omitempty"`
Versions map[string]string `json:"versions,omitempty"`


#### Why not we use existing SandboxTemplate?

There is a existing [`SandboxTemplate`](http://github.com/kubernetes-sigs/agent-sandbox/blob/main/extensions/api/v1alpha1/sandboxtemplate_types.go#L57) in the kubernetes-sigs/agent-sandbox project. However, it is designed to be a generic template for various sandbox types and may not cater specifically to the unique requirements of Agent and CodeInterpreter runtimes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

There's a minor grammatical error in this sentence.

Suggested change
There is a existing [`SandboxTemplate`](http://github.com/kubernetes-sigs/agent-sandbox/blob/main/extensions/api/v1alpha1/sandboxtemplate_types.go#L57) in the kubernetes-sigs/agent-sandbox project. However, it is designed to be a generic template for various sandbox types and may not cater specifically to the unique requirements of Agent and CodeInterpreter runtimes.
There is an existing [`SandboxTemplate`](http://github.com/kubernetes-sigs/agent-sandbox/blob/main/extensions/api/v1alpha1/sandboxtemplate_types.go#L57) in the kubernetes-sigs/agent-sandbox project. However, it is designed to be a generic template for various sandbox types and may not cater specifically to the unique requirements of Agent and CodeInterpreter runtimes.

Comment on lines +53 to +57
// Languages declares the set of languages/runtimes that this code interpreter
// environment supports (e.g. ["python", "bash"]). This is metadata to help
// routers / UIs select a compatible runtime.
// +optional
Languages []string `json:"languages,omitempty" protobuf:"bytes,6,rep,name=languages"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The Languages field is defined here in CodeInterpreterRuntimeSpec, but it is missing from the corresponding struct definition in the design document (docs/design/runtime-template-proposal.md). Please update the design document to include this field for consistency.


type AgentRuntimeSpec struct {
// Ports is a list of ports that the agent runtime will expose.
Ports []TargetPort
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The Ports field is missing a json tag. Based on the design document's YAML example, the tag should be ports. Adding omitempty is also recommended for slice fields.

Suggested change
Ports []TargetPort
Ports []TargetPort `json:"ports,omitempty"`

There is a existing [`SandboxTemplate`](http://github.com/kubernetes-sigs/agent-sandbox/blob/main/extensions/api/v1alpha1/sandboxtemplate_types.go#L57) in the kubernetes-sigs/agent-sandbox project. However, it is designed to be a generic template for various sandbox types and may not cater specifically to the unique requirements of Agent and CodeInterpreter runtimes.

- SandboxTemplate simply reuses pod template, making it hard to express multi-version runtimes. As it is common to have multiple versions of Agent or CodeInterpreter runtimes, a more specialized template is needed to manage these variations effectively.
- Different runtimes may have distinct configuration needs that are not adequately addressed by a generic pod template. Likely we need to support warmpool for code interpreter runtime, but not for agent runtime. Because code interpreter needs very lower latency for cold start, while agent runtime can afford longer cold start time.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The phrase "very lower" is grammatically incorrect. Consider using "very low" or "much lower" instead for better clarity.

Suggested change
- Different runtimes may have distinct configuration needs that are not adequately addressed by a generic pod template. Likely we need to support warmpool for code interpreter runtime, but not for agent runtime. Because code interpreter needs very lower latency for cold start, while agent runtime can afford longer cold start time.
- Different runtimes may have distinct configuration needs that are not adequately addressed by a generic pod template. Likely we need to support warmpool for code interpreter runtime, but not for agent runtime. Because code interpreter needs very low latency for cold start, while agent runtime can afford longer cold start time.

In order to expose the code interpreter internally or externally, we also need to define a `CodeInterpreterEndpoint` CRD, it can be used to bind to a specific `CodeInterpreterRuntime` version.
With both `CodeInterpreterRuntime` and `CodeInterpreterEndpoint` published, users can access the code interpreter runtime through the endpoint `https://<frontend>:<frontend-port>/v1/namespaces/{codeInterpreterNamespace}/codeinterpreters/{codeInterpreterName}/<code-interpreter specific path>?endpoint=<code-interpreter-endpoint>`.

`CodeInterpreterEndpoint` is similar as `AgentEndpoint`, it provides a way to access a specific version of that runtime. If no `CodeInterpreterEndpoint` is specified, the system will default to using the `DefaultVersion` defined in the `CodeInterpreterRuntime` status. For example, users can publish a python code interpreter runtime for different versions like `3.10`, `3.11`, `3.12`, then create different `CodeInterpreterEndpoint` to bind to different versions.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

There's a minor grammatical error here. "similar as" should be "similar to".

Suggested change
`CodeInterpreterEndpoint` is similar as `AgentEndpoint`, it provides a way to access a specific version of that runtime. If no `CodeInterpreterEndpoint` is specified, the system will default to using the `DefaultVersion` defined in the `CodeInterpreterRuntime` status. For example, users can publish a python code interpreter runtime for different versions like `3.10`, `3.11`, `3.12`, then create different `CodeInterpreterEndpoint` to bind to different versions.
`CodeInterpreterEndpoint` is similar to `AgentEndpoint`, it provides a way to access a specific version of that runtime. If no `CodeInterpreterEndpoint` is specified, the system will default to using the `DefaultVersion` defined in the `CodeInterpreterRuntime` status. For example, users can publish a python code interpreter runtime for different versions like `3.10`, `3.11`, `3.12`, then create different `CodeInterpreterEndpoint` to bind to different versions.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a declarative API design for managing Agent and CodeInterpreter runtimes in AgentCube. The proposal enables users to define runtime templates that automatically create sandboxes on first invocation, with support for multi-version management, session lifecycle controls, and specialized security configurations for code execution environments.

Key changes:

  • Adds AgentRuntime and AgentEndpoint CRDs for managing agent runtime environments
  • Adds CodeInterpreterRuntime and CodeInterpreterEndpoint CRDs for managing code interpreter sandboxes with enhanced security controls
  • Provides comprehensive design documentation explaining the rationale and usage patterns

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.

File Description
pkg/apis/runtime/agent_type.go Defines API types for AgentRuntime and AgentEndpoint, including SandboxTemplate and TargetPort configuration
pkg/apis/runtime/code_interpreter_type.go Defines API types for CodeInterpreterRuntime and CodeInterpreterEndpoint with specialized security-focused sandbox template
docs/design/runtime-template-proposal.md Comprehensive design proposal documenting motivation, API design, usage examples, and alternatives

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


type AgentRuntimeSpec struct {
// Ports is a list of ports that the agent runtime will expose.
Ports []TargetPort
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The Ports field is missing JSON and protobuf struct tags, which are present on all other fields in the spec. This inconsistency could cause serialization issues. Add the appropriate tags: json:\"ports,omitempty\" protobuf:\"bytes,5,rep,name=ports\"

Suggested change
Ports []TargetPort
Ports []TargetPort `json:"ports,omitempty" protobuf:"bytes,5,rep,name=ports"`

Copilot uses AI. Check for mistakes.

// PodTemplate describes the template that will be used to create an agent sandbox.
// +kubebuilder:validation:Required
Template *SandboxTemplate `json:"podTemplate" protobuf:"bytes,1,opt,name=podTemplate"`
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The JSON field name podTemplate doesn't match the Go field name Template. This inconsistency can cause confusion. Consider either renaming the Go field to PodTemplate or changing the JSON field to template for consistency with the CodeInterpreterRuntime API which uses template for both.

Suggested change
Template *SandboxTemplate `json:"podTemplate" protobuf:"bytes,1,opt,name=podTemplate"`
Template *SandboxTemplate `json:"template" protobuf:"bytes,1,opt,name=podTemplate"`

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +67
DefaultVersion string `json:"defaultVersion"`
Versions map[string]string `json:"versions"`
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The AgentRuntimeStatus fields are missing the omitempty tag and protobuf annotations that are consistently used in CodeInterpreterRuntimeStatus. For consistency and to allow empty status values, add json:\"defaultVersion,omitempty\" protobuf:\"bytes,1,opt,name=defaultVersion\" and json:\"versions,omitempty\" protobuf:\"bytes,2,rep,name=versions\".

Suggested change
DefaultVersion string `json:"defaultVersion"`
Versions map[string]string `json:"versions"`
DefaultVersion string `json:"defaultVersion,omitempty" protobuf:"bytes,1,opt,name=defaultVersion"`
Versions map[string]string `json:"versions,omitempty" protobuf:"bytes,2,rep,name=versions"`

Copilot uses AI. Check for mistakes.
// Target specifies the target agent runtime.
// +kubebuilder:validation:Required
Target string `json:"target" protobuf:"bytes,1,opt,name=target"`
// Version specifies the version of the agent runtime.
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The Version field in AgentEndpointSpec lacks the +kubebuilder:validation:Required annotation, while the design document (line 235) indicates it should be required. This inconsistency with CodeInterpreterEndpointSpec (which also doesn't mark it as required) suggests unclear API semantics. If version is optional and defaults to DefaultVersion, document this behavior; otherwise, add the validation annotation.

Suggested change
// Version specifies the version of the agent runtime.
// Version specifies the version of the agent runtime.
// +kubebuilder:validation:Required

Copilot uses AI. Check for mistakes.
Comment on lines +53 to +63
// Languages declares the set of languages/runtimes that this code interpreter
// environment supports (e.g. ["python", "bash"]). This is metadata to help
// routers / UIs select a compatible runtime.
// +optional
Languages []string `json:"languages,omitempty" protobuf:"bytes,6,rep,name=languages"`

// WarmPoolSize specifies the number of pre-warmed sandboxes to maintain
// for this code interpreter runtime. Pre-warmed sandboxes can reduce startup
// latency for new sessions at the cost of additional resource usage.
// +optional
WarmPoolSize *int32 `json:"warmPoolSize,omitempty" protobuf:"varint,5,opt,name=warmPoolSize"`
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

[nitpick] The protobuf field number 6 comes after field number 5 (WarmPoolSize at line 63), but in the struct definition Languages appears before WarmPoolSize. This ordering mismatch between struct field order and protobuf field numbers can make the code harder to maintain. Consider reordering the struct fields to match the protobuf numbering sequence.

Suggested change
// Languages declares the set of languages/runtimes that this code interpreter
// environment supports (e.g. ["python", "bash"]). This is metadata to help
// routers / UIs select a compatible runtime.
// +optional
Languages []string `json:"languages,omitempty" protobuf:"bytes,6,rep,name=languages"`
// WarmPoolSize specifies the number of pre-warmed sandboxes to maintain
// for this code interpreter runtime. Pre-warmed sandboxes can reduce startup
// latency for new sessions at the cost of additional resource usage.
// +optional
WarmPoolSize *int32 `json:"warmPoolSize,omitempty" protobuf:"varint,5,opt,name=warmPoolSize"`
// WarmPoolSize specifies the number of pre-warmed sandboxes to maintain
// for this code interpreter runtime. Pre-warmed sandboxes can reduce startup
// latency for new sessions at the cost of additional resource usage.
// +optional
WarmPoolSize *int32 `json:"warmPoolSize,omitempty" protobuf:"varint,5,opt,name=warmPoolSize"`
// Languages declares the set of languages/runtimes that this code interpreter
// environment supports (e.g. ["python", "bash"]). This is metadata to help
// routers / UIs select a compatible runtime.
// +optional
Languages []string `json:"languages,omitempty" protobuf:"bytes,6,rep,name=languages"`

Copilot uses AI. Check for mistakes.
// Target specifies the target code interpreter runtime.
// +kubebuilder:validation:Required
Target string `json:"target" protobuf:"bytes,1,opt,name=target"`
// Version specifies the version of the code interpreter runtime.
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The Version field in CodeInterpreterEndpointSpec is missing the +kubebuilder:validation:Required annotation. Based on the design document and API semantics, if this field is optional and defaults to DefaultVersion from the runtime status, this should be explicitly documented in a comment. Otherwise, add the validation annotation for consistency.

Suggested change
// Version specifies the version of the code interpreter runtime.
// Version specifies the version of the code interpreter runtime.
// +kubebuilder:validation:Required

Copilot uses AI. Check for mistakes.
Comment on lines +146 to +148
below is an example of how to define an `AgentRuntime` CRD for an agent runtime environment:
```yaml
apiVersion: runtime.agentcube.io/v1alpha1 # adjust to your actual group/version
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

[nitpick] The example uses runtime.agentcube.io/v1alpha1 as the API group, but this doesn't match the actual package path (pkg/apis/runtime). For clarity, either update the example to use a consistent API group name or add a note explaining that the actual API group will be determined during implementation.

Suggested change
below is an example of how to define an `AgentRuntime` CRD for an agent runtime environment:
```yaml
apiVersion: runtime.agentcube.io/v1alpha1 # adjust to your actual group/version
Below is an example of how to define an `AgentRuntime` CRD for an agent runtime environment.
> **Note:** The `apiVersion` field below uses a placeholder value. The actual API group and version will be determined during implementation and should match your project's configuration (e.g., it may be derived from the Go package path such as `pkg/apis/runtime`).
```yaml
apiVersion: <your-api-group>/v1alpha1 # replace with your actual group/version

Copilot uses AI. Check for mistakes.

type AgentRuntimeSpec struct {
// Ports is a list of ports that the agent runtime will expose.
Ports []TargetPort
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The code example in the design document shows Ports []TargetPort without struct tags, which doesn't match the actual implementation in agent_type.go (line 22). While the implementation also lacks tags (which is a separate issue), the documentation should show the correct/intended API design with proper tags.

Suggested change
Ports []TargetPort
Ports []TargetPort `json:"ports,omitempty" protobuf:"bytes,1,opt,name=ports"`

Copilot uses AI. Check for mistakes.
Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,2,rep,name=annotations"`
// Spec is the Pod's spec
// +kubebuilder:validation:Required
Spec corev1.PodSpec `json:"spec" protobuf:"bytes,3,opt,name=spec"`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

shall we use PodTemplate instead of PodSpec here?


// PodTemplate describes the template that will be used to create an agent sandbox.
// +kubebuilder:validation:Required
Template *SandboxTemplate `json:"podTemplate" protobuf:"bytes,1,opt,name=podTemplate"`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Template *SandboxTemplate `json:"podTemplate" protobuf:"bytes,1,opt,name=podTemplate"`
Template *SandboxTemplate `json:"Template" protobuf:"bytes,1,opt,name=Template"`

Signed-off-by: Zhonghu Xu <xuzhonghu@huawei.com>
Signed-off-by: Zhonghu Xu <xuzhonghu@huawei.com>
Copilot AI review requested due to automatic review settings November 27, 2025 06:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


// Template describes the template that will be used to create an agent sandbox.
// +kubebuilder:validation:Required
Template *SandboxTemplate `json:"template" protobuf:"bytes,1,opt,name=template"`
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The documentation example on line 82 references Template field but uses JSON tag template, while the actual code in agent_type.go line 26 uses JSON tag podTemplate. This creates an inconsistency between the documentation and the implementation. The JSON tag in the code should be changed to template to match the documentation and the field name.

Suggested change
Template *SandboxTemplate `json:"template" protobuf:"bytes,1,opt,name=template"`
Template *SandboxTemplate `json:"podTemplate" protobuf:"bytes,1,opt,name=podTemplate"`

Copilot uses AI. Check for mistakes.
There is a existing [`SandboxTemplate`](http://github.com/kubernetes-sigs/agent-sandbox/blob/main/extensions/api/v1alpha1/sandboxtemplate_types.go#L57) in the kubernetes-sigs/agent-sandbox project. However, it is designed to be a generic template for various sandbox types and may not cater specifically to the unique requirements of Agent and CodeInterpreter runtimes.

- SandboxTemplate simply reuses pod template, making it hard to express multi-version runtimes. As it is common to have multiple versions of Agent or CodeInterpreter runtimes, a more specialized template is needed to manage these variations effectively.
- Different runtimes may have distinct configuration needs that are not adequately addressed by a generic pod template. Likely we need to support warmpool for code interpreter runtime, but not for agent runtime. Because code interpreter needs very lower latency for cold start, while agent runtime can afford longer cold start time.
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

Typo in line 55: "lower" should be "low". The phrase should read "very low latency" instead of "very lower latency".

Suggested change
- Different runtimes may have distinct configuration needs that are not adequately addressed by a generic pod template. Likely we need to support warmpool for code interpreter runtime, but not for agent runtime. Because code interpreter needs very lower latency for cold start, while agent runtime can afford longer cold start time.
- Different runtimes may have distinct configuration needs that are not adequately addressed by a generic pod template. Likely we need to support warmpool for code interpreter runtime, but not for agent runtime. Because code interpreter needs very low latency for cold start, while agent runtime can afford longer cold start time.

Copilot uses AI. Check for mistakes.

### Summary

This proposal outlines a design for introducing a declarative API to manage runtime specifically for Agent and CodeInterpreter runtimes in AgentCube. The goal is to enable users to define desired states for their sandboxes, allowing the system to automatically handle creation on the arrival of first invocation. The whole workflow out of the scope of this proposal. So we will focus on the declarative API design and about the whole system architecture, there will be another proposal.
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

Missing article in line 19: "to manage runtime specifically" should be "to manage runtimes specifically" or "to manage the runtime specifically".

Suggested change
This proposal outlines a design for introducing a declarative API to manage runtime specifically for Agent and CodeInterpreter runtimes in AgentCube. The goal is to enable users to define desired states for their sandboxes, allowing the system to automatically handle creation on the arrival of first invocation. The whole workflow out of the scope of this proposal. So we will focus on the declarative API design and about the whole system architecture, there will be another proposal.
This proposal outlines a design for introducing a declarative API to manage runtimes specifically for Agent and CodeInterpreter runtimes in AgentCube. The goal is to enable users to define desired states for their sandboxes, allowing the system to automatically handle creation on the arrival of first invocation. The whole workflow out of the scope of this proposal. So we will focus on the declarative API design and about the whole system architecture, there will be another proposal.

Copilot uses AI. Check for mistakes.
There is a existing [`SandboxTemplate`](http://github.com/kubernetes-sigs/agent-sandbox/blob/main/extensions/api/v1alpha1/sandboxtemplate_types.go#L57) in the kubernetes-sigs/agent-sandbox project. However, it is designed to be a generic template for various sandbox types and may not cater specifically to the unique requirements of Agent and CodeInterpreter runtimes.

- SandboxTemplate simply reuses pod template, making it hard to express multi-version runtimes. As it is common to have multiple versions of Agent or CodeInterpreter runtimes, a more specialized template is needed to manage these variations effectively.
- Different runtimes may have distinct configuration needs that are not adequately addressed by a generic pod template. Likely we need to support warmpool for code interpreter runtime, but not for agent runtime. Because code interpreter needs very lower latency for cold start, while agent runtime can afford longer cold start time.
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

Missing word on line 55: "warmpool for code interpreter runtime" should be "warmpool for code interpreter runtimes" or "a warmpool for code interpreter runtime".

Suggested change
- Different runtimes may have distinct configuration needs that are not adequately addressed by a generic pod template. Likely we need to support warmpool for code interpreter runtime, but not for agent runtime. Because code interpreter needs very lower latency for cold start, while agent runtime can afford longer cold start time.
- Different runtimes may have distinct configuration needs that are not adequately addressed by a generic pod template. Likely we need to support a warmpool for code interpreter runtime, but not for agent runtime. Because code interpreter needs very lower latency for cold start, while agent runtime can afford longer cold start time.

Copilot uses AI. Check for mistakes.

### Alternatives

We can also design a restful api server to manage the lifecycle of agent runtimes, that will make the runtime management more flexible. However, it will introduce additional complexity in terms of deployment, scaling, and maintenance of the restful api server. So the first stage, we can make use of kubernetes CRD and operator to manage different kinds of runtime.
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

Article missing in line 333: "we can make use of kubernetes CRD" should be "we can make use of the Kubernetes CRD" or "we can make use of Kubernetes CRDs".

Suggested change
We can also design a restful api server to manage the lifecycle of agent runtimes, that will make the runtime management more flexible. However, it will introduce additional complexity in terms of deployment, scaling, and maintenance of the restful api server. So the first stage, we can make use of kubernetes CRD and operator to manage different kinds of runtime.
We can also design a restful api server to manage the lifecycle of agent runtimes, that will make the runtime management more flexible. However, it will introduce additional complexity in terms of deployment, scaling, and maintenance of the restful api server. So the first stage, we can make use of the Kubernetes CRD and operator to manage different kinds of runtime.

Copilot uses AI. Check for mistakes.

### Alternatives

We can also design a restful api server to manage the lifecycle of agent runtimes, that will make the runtime management more flexible. However, it will introduce additional complexity in terms of deployment, scaling, and maintenance of the restful api server. So the first stage, we can make use of kubernetes CRD and operator to manage different kinds of runtime.
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

Grammar issue on line 333: "So the first stage" should be "So in the first stage" or "So for the first stage".

Suggested change
We can also design a restful api server to manage the lifecycle of agent runtimes, that will make the runtime management more flexible. However, it will introduce additional complexity in terms of deployment, scaling, and maintenance of the restful api server. So the first stage, we can make use of kubernetes CRD and operator to manage different kinds of runtime.
We can also design a restful api server to manage the lifecycle of agent runtimes, that will make the runtime management more flexible. However, it will introduce additional complexity in terms of deployment, scaling, and maintenance of the restful api server. So in the first stage, we can make use of kubernetes CRD and operator to manage different kinds of runtime.

Copilot uses AI. Check for mistakes.

### Summary

This proposal outlines a design for introducing a declarative API to manage runtime specifically for Agent and CodeInterpreter runtimes in AgentCube. The goal is to enable users to define desired states for their sandboxes, allowing the system to automatically handle creation on the arrival of first invocation. The whole workflow out of the scope of this proposal. So we will focus on the declarative API design and about the whole system architecture, there will be another proposal.
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

Grammar issue on line 19: "The whole workflow out of the scope" should be "The whole workflow is out of the scope" or "The whole workflow is outside the scope".

Suggested change
This proposal outlines a design for introducing a declarative API to manage runtime specifically for Agent and CodeInterpreter runtimes in AgentCube. The goal is to enable users to define desired states for their sandboxes, allowing the system to automatically handle creation on the arrival of first invocation. The whole workflow out of the scope of this proposal. So we will focus on the declarative API design and about the whole system architecture, there will be another proposal.
This proposal outlines a design for introducing a declarative API to manage runtime specifically for Agent and CodeInterpreter runtimes in AgentCube. The goal is to enable users to define desired states for their sandboxes, allowing the system to automatically handle creation on the arrival of first invocation. The whole workflow is out of the scope of this proposal. So we will focus on the declarative API design and about the whole system architecture, there will be another proposal.

Copilot uses AI. Check for mistakes.

### Design Details

#### Why not we use existing SandboxTemplate?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But we use its SandboxWarmPool which reference its existing SanboxTemplate?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I mean why do we design a api instead of using SanboxTemplate

Signed-off-by: Zhonghu Xu <xuzhonghu@huawei.com>
@volcano-sh-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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

@volcano-sh-bot volcano-sh-bot merged commit 72bdb12 into volcano-sh:main Nov 28, 2025
4 checks passed
@hzxuzhonghu hzxuzhonghu deleted the agent-code-runtime branch November 28, 2025 02:20
Copilot AI mentioned this pull request Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants