Skip to content

Add Agentrun CLI#54

Merged
volcano-sh-bot merged 36 commits intovolcano-sh:mainfrom
acsoto:agentrun
Dec 17, 2025
Merged

Add Agentrun CLI#54
volcano-sh-bot merged 36 commits intovolcano-sh:mainfrom
acsoto:agentrun

Conversation

@acsoto
Copy link
Copy Markdown
Member

@acsoto acsoto commented Dec 3, 2025

This pull request introduces the initial implementation of the AgentRun CLI, providing the foundation for packaging, building, and deploying AI agents to AgentCube. It adds core modules, data models, and documentation to guide users and developers. The most important changes are grouped below:

Core Functionality and Runtime Implementation

  • Added the main agentrun Python package with CLI entry point (app) and runtime classes for packaging, building, publishing, and invoking agents, making these available for both CLI and SDK use (agentrun/__init__.py).
  • Implemented the BuildRuntime class to handle building agent images from workspaces, including version auto-incrementing, Docker-based local builds, validation, and metadata updates (agentrun/runtime/build_runtime.py).
  • Added runtime module initializers and structured imports for all runtime classes and the MetadataOptions model, clarifying the separation between CLI, runtime, and operations layers (agentrun/runtime/__init__.py, agentrun/operations/__init__.py, agentrun/cli/__init__.py). [1] [2] [3]

Data Modeling

  • Introduced the MetadataOptions dataclass to standardize agent configuration options and facilitate metadata handling throughout the agent lifecycle (agentrun/models/pack_models.py).

Documentation and Project Structure

  • Added a comprehensive README.md describing AgentRun CLI’s purpose, quick start instructions, features, architecture, supported languages, troubleshooting, and command reference. This serves as both user and developer documentation (README.md).
  • Updated .gitignore to exclude agent-specific configuration and build files from version control (.gitignore).

Copilot AI review requested due to automatic review settings December 3, 2025 06:24
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @acsoto, 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 the initial implementation of the AgentRun CLI, a powerful new tool designed to simplify the end-to-end lifecycle management of AI agents on the AgentCube platform. It provides commands for packaging agent code, building container images, publishing agents to Kubernetes (either as AgentCube Custom Resources or standard deployments), invoking them, and checking their status. The changes establish a modular architecture, comprehensive documentation, and robust service integrations for Docker and Kubernetes, making agent development and deployment more efficient.

Highlights

  • AgentRun CLI Introduction: Introduces the AgentRun CLI, a new developer tool designed to streamline the entire lifecycle of AI agents, from packaging and building to publishing and invocation on the AgentCube platform.
  • Comprehensive Documentation: Adds a detailed README.md file covering features, architecture, usage instructions, supported commands, agent configuration, troubleshooting, and relevant links for the AgentRun CLI.
  • Core Package Structure: Establishes the foundational Python package structure with __init__.py files for agentrun, cli, runtime, and operations modules, exposing key classes and functions.
  • Build Runtime Logic: Implements BuildRuntime to manage the building of agent images, supporting local Docker builds, workspace validation, build argument injection, and metadata updates.
  • Invoke Runtime Logic: Implements InvokeRuntime to handle the invocation of published agents via AgentCube or direct HTTP endpoints, including support for custom headers, metadata validation, and mock responses for local testing.
  • Pack Runtime Logic: Introduces PackRuntime for packaging agent applications into a standardized workspace, including validation, metadata management, language compatibility checks, dependency processing, and automatic Dockerfile generation for Python and Java.
  • Publish Runtime Logic: Adds PublishRuntime to facilitate the deployment of agents to either AgentCube (using Custom Resources) or standard Kubernetes clusters (using Deployments and Services), with readiness checks.
  • Status Runtime Logic: Includes StatusRuntime for checking the operational status of published agents, providing detailed information from AgentCube or Kubernetes.
  • Kubernetes and Docker Services: Integrates new service layers: AgentCubeProvider for CRD-based deployments, KubernetesProvider for standard K8s deployments, and DockerService for image building and pushing.
  • Agent Metadata Management: Introduces MetadataService with a Pydantic AgentMetadata model for robust loading, saving, updating, and validation of agent configuration.
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.

@acsoto
Copy link
Copy Markdown
Member Author

acsoto commented Dec 3, 2025

ping @hzxuzhonghu

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 the AgentRun CLI, a substantial and well-structured tool for managing AI agents. The code is modular, following a clear architecture with CLI, runtime, operations, and services layers. The use of Typer and Rich for the CLI provides a great user experience, and the documentation is comprehensive. However, I've identified several issues, including some critical bugs related to CLI argument parsing and logger initialization that would cause runtime errors. There are also some high-severity issues concerning unsafe file operations, incorrect credential handling, and improper command parsing that could lead to data loss or security vulnerabilities. Additionally, there are several medium-severity issues related to code duplication, encapsulation, and error handling that should be addressed to improve maintainability and robustness. My review includes specific suggestions to fix these issues.

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 the AgentRun CLI, a comprehensive developer tool for packaging, building, publishing, and invoking AI agents on the AgentCube platform. The implementation establishes a well-structured four-layer architecture (CLI, Runtime, Operations, Services) with support for multiple deployment providers and programming languages.

Key Changes

  • Implements complete CLI commands (pack, build, publish, invoke, status) using Typer with rich console output
  • Provides dual deployment provider support: AgentCube Custom Resources and standard Kubernetes Deployments/Services
  • Establishes service layer abstractions for Docker operations, Kubernetes interactions, and metadata management

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 28 comments.

Show a summary per file
File Description
cmd/agentrun/pyproject.toml Defines project metadata, dependencies, and tool configurations supporting Python 3.8+
cmd/agentrun/README.md Comprehensive documentation covering installation, usage, architecture, and troubleshooting
cmd/agentrun/.gitignore Excludes generated files (agent_metadata.yaml, Dockerfile)
cmd/agentrun/agentrun/init.py Exposes main CLI app and runtime classes for programmatic SDK usage
cmd/agentrun/agentrun/cli/main.py Typer-based CLI implementation with rich console output for all commands
cmd/agentrun/agentrun/runtime/*.py Business logic for pack, build, publish, invoke, and status commands
cmd/agentrun/agentrun/services/metadata_service.py Pydantic-based metadata validation and workspace management
cmd/agentrun/agentrun/services/docker_service.py Docker SDK integration for image building and registry operations
cmd/agentrun/agentrun/services/k8s_provider.py Standard Kubernetes Deployment/Service provisioning
cmd/agentrun/agentrun/services/agentcube_provider.py AgentRuntime Custom Resource deployment
cmd/agentrun/examples/hello-agent/main.py Example Python agent demonstrating HTTP server implementation
cmd/agentrun/examples/hello-agent/requirements.txt Minimal dependencies file for example agent
Comments suppressed due to low confidence (3)

cmd/agentrun/agentrun/services/k8s_provider.py:212

  • Variable existing is not used.
            existing = self.apps_api.read_namespaced_deployment(

cmd/agentrun/agentrun/services/k8s_provider.py:268

  • Variable existing is not used.
            existing = self.core_api.read_namespaced_service(

cmd/agentrun/agentrun/services/k8s_provider.py:50

  • Except block directly handles BaseException.
                except:

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

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 20 out of 20 changed files in this pull request and generated 13 comments.

Comments suppressed due to low confidence (2)

cmd/agentrun/agentrun/services/k8s_provider.py:217

  • Variable existing is not used.
            existing = self.apps_api.read_namespaced_deployment(

cmd/agentrun/agentrun/services/k8s_provider.py:273

  • Variable existing is not used.
            existing = self.core_api.read_namespaced_service(

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

acsoto and others added 16 commits December 7, 2025 14:34
…E files

Signed-off-by: Zhou Zihang <z@mcac.cc>
Signed-off-by: opertw <taoruiw@andrew.cmu.edu>
Signed-off-by: opertw <taoruiw@andrew.cmu.edu>
Signed-off-by: Zhou Zihang <z@mcac.cc>
Signed-off-by: Zhou Zihang <z@mcac.cc>
…etes provider alongside AgentCube, refactor related classes and methods for improved clarity and functionality.

Signed-off-by: Zhou Zihang <z@mcac.cc>
…d enhance metadata updates with deployment status

Signed-off-by: Zhou Zihang <z@mcac.cc>
Signed-off-by: Zhou Zihang <z@mcac.cc>
Signed-off-by: Zhou Zihang <z@mcac.cc>
Signed-off-by: opertw <taoruiw@andrew.cmu.edu>
Signed-off-by: Zhou Zihang <z@mcac.cc>
Signed-off-by: opertw <taoruiw@andrew.cmu.edu>
Signed-off-by: opertw <taoruiw@andrew.cmu.edu>
Signed-off-by: opertw <taoruiw@andrew.cmu.edu>
Copilot AI review requested due to automatic review settings December 9, 2025 12:30
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

LaynePeng

This comment was marked as duplicate.

@volcano-sh-bot
Copy link
Copy Markdown
Contributor

@LaynePeng: changing LGTM is restricted to collaborators

Details

In response to this:

/lgtm

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/test-infra repository.

Copy link
Copy Markdown
Contributor

@LaynePeng LaynePeng left a comment

Choose a reason for hiding this comment

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

/lgtm

@volcano-sh-bot
Copy link
Copy Markdown
Contributor

@LaynePeng: changing LGTM is restricted to collaborators

Details

In response to this:

/lgtm

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/test-infra repository.

Signed-off-by: opertw <taoruiw@andrew.cmu.edu>
Copilot AI review requested due to automatic review settings December 10, 2025 07:45
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@t2wang
Copy link
Copy Markdown
Contributor

t2wang commented Dec 11, 2025

I have addressed all the comments @hzxuzhonghu @LaynePeng

Signed-off-by: opertw <taoruiw@andrew.cmu.edu>
Copilot AI review requested due to automatic review settings December 11, 2025 11:51
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

"--payload",
help="JSON-formatted input passed to the agent",
),
header: Optional[List[str]] = typer.Option(
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.

It will be clearer to rename the header variable to header_list.

for h in header:
if ':' in h:
key, value = h.split(':', 1)
headers[key.strip()] = value.strip()
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.

Maybe add a validation step: if the split result of h doesn’t have exactly two parts, we should handle that invalid case (e.g., throw a user-friendly error).

Signed-off-by: opertw <taoruiw@andrew.cmu.edu>
Signed-off-by: opertw <taoruiw@andrew.cmu.edu>
Copilot AI review requested due to automatic review settings December 17, 2025 03:31
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Signed-off-by: opertw <taoruiw@andrew.cmu.edu>
Copilot AI review requested due to automatic review settings December 17, 2025 06:49
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Signed-off-by: opertw <taoruiw@andrew.cmu.edu>
@t2wang
Copy link
Copy Markdown
Contributor

t2wang commented Dec 17, 2025

I have addressed all the comments @hzxuzhonghu @LaynePeng @MahaoAlex

@hzxuzhonghu
Copy link
Copy Markdown
Member

/lgtm

@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: LaynePeng

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 16b257b into volcano-sh:main Dec 17, 2025
4 checks passed
@t2wang t2wang deleted the agentrun branch December 17, 2025 07:48
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.

7 participants