-
Notifications
You must be signed in to change notification settings - Fork 78
Feat/cli #275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feat/cli #275
Conversation
|
Zhicheng Zhang seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
1 similar comment
|
Zhicheng Zhang seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
There was a problem hiding this 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 comprehensive CLI system for AgentScope Runtime, adding a unified as-runtime command-line interface that consolidates agent development, deployment, and runtime operations. The PR includes build caching for faster deployments, enhanced deployment management across multiple platforms (local, k8s, modelstudio, agentrun), and improved temporary file organization.
Key Changes:
- New unified CLI system with commands: run, web, deploy, stop, list, status, invoke, sandbox
- Build cache implementation with content-aware hashing for faster repeated deployments
- Enhanced deployer interfaces with standardized stop() methods across all platforms
Reviewed changes
Copilot reviewed 46 out of 47 changed files in this pull request and generated 28 comments.
Show a summary per file
| File | Description |
|---|---|
src/agentscope_runtime/cli/ |
New CLI module with command implementations, agent loaders, state management, and utilities |
src/agentscope_runtime/engine/deployers/utils/build_cache.py |
Build cache system with content hashing and workspace management |
src/agentscope_runtime/engine/deployers/ |
Updated deployers with stop() method, build directory improvements, and entrypoint support |
src/agentscope_runtime/engine/deployers/utils/docker_image_utils/ |
Enhanced Docker image building with platform support and wheel merging |
src/agentscope_runtime/engine/deployers/utils/k8s_utils.py |
K8s environment detection for local vs cloud clusters |
tests/deploy/test_build_cache.py |
Comprehensive test suite for build cache functionality |
pyproject.toml |
Added click dependency and as-runtime console script |
examples/deployments/ |
Example configuration files for various deployment platforms |
cookbook/en/cli/README.md |
CLI documentation and usage guide |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f449c4e to
0ca1238
Compare
| runtime-sandbox-mcp = "agentscope_runtime.sandbox.mcp_server:main" | ||
| runtime-sandbox-server = "agentscope_runtime.sandbox.manager.server.app:main" | ||
| runtime-sandbox-builder = "agentscope_runtime.sandbox.build:main" | ||
| runtime-fc-deploy = "agentscope_runtime.engine.deployers.cli_fc_deploy:main" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove agentscope-runtime-fc-deploy and integrate to as-runtime / main cli?
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project.scripts] | ||
| as-runtime = "agentscope_runtime.cli.cli:main" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of maintaining multiple long CLI entry points (runtime-sandbox-mcp, runtime-sandbox-server, runtime-fc-deploy, etc.), we could unify them into a single agentscope-runtime CLI and route to the specific functionalities via subcommands or arguments.
This would reduce duplication in pyproject.toml, make the commands easier to remember, and keep naming consistent.
For example:
agentscope-runtime sandbox mcp
agentscope-runtime sandbox server
agentscope-runtime sandbox build
agentscope-runtime fc-deploy
agentscope-runtime modelstudio mcp-server
| from ..adapters.agentscope.message import message_to_agentscope_msg | ||
| from agentscope import setup_logger | ||
|
|
||
| setup_logger("ERROR") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe move to adapters stream.py
|
|
||
| @click.command() | ||
| @click.argument("source", required=True) | ||
| @click.option( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default argument is mismatched with agent_app.run (0.0.0.0)
| help="Host address to bind to", | ||
| default="127.0.0.1", | ||
| ) | ||
| @click.option( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default argument is mismatched with agent_app.run (8080)
| @@ -0,0 +1,120 @@ | |||
| # -*- coding: utf-8 -*- | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d strongly recommend leveraging Rich for output formatting instead of plain click.secho / ASCII tables:
Suggested improvements:
- Centralize style config – avoid repeating emoji/color logic in each
echo_*function. Define aSTYLESdict and reuse. - Upgrade table rendering – replace manual ASCII table (
format_table) withrich.table.Tablefor better alignment (handles wide chars) and richer visuals. - Improve JSON display – use
rich.json.JSONorconsole.print_json()to give syntax‑highlighted JSON instead of plainjson.dumps. - Consistent layout components –
rich.panel.PanelorColumnscan make headers and grouped output more readable. - Windows compatibility – Rich automatically handles ANSI colors on Windows, eliminating need for manual Click color handling.
These changes will make CLI output visually appealing, more readable, and more consistent across platforms, while keeping Click for argument parsing.
| @@ -0,0 +1,786 @@ | |||
| # -*- coding: utf-8 -*- | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about rename to chat?
| "'main.py')", | ||
| default=None, | ||
| ) | ||
| def run( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe try signal.signal(signal.SIGINT, handle_sigint) ?

Description
Todo:
Run an agent in interactive way with multi-turn
Run an agent in simple reply
Run an agent with webui
Deployment
modelstudio
k8s
local
as-runtime deploy local examples/deployments/detached_local_deploy/app_agent.py --env DASHSCOPE_API_KEY=sk-xxxAn URL will be print in the terminal, user could query the agent by this url,
or call run cli
A deployment id will be print in the terminal, then use it to stop
Related 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]