Skip to content

feat: add pyhon cli for all language and platform - #67

Merged
Zhiyue-Wang merged 6 commits into
mainfrom
feature/test
Nov 13, 2026
Merged

Zhiyue-Wang merged 6 commits into
mainfrom
feature/test

Conversation

@Zhiyue-Wang

Copy link
Copy Markdown
Collaborator

Description

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🎨 Style/formatting change
  • ♻️ Code refactoring
  • ⚡ Performance improvement
  • ✅ Test addition/update

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Manual testing

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Related Issues

Screenshots (if applicable)

… CLI

Make the Python agentarts CLI the single CLI for all language SDKs by
adding Java agent support and a PyInstaller-built standalone binary.

Java support (branch on base.language == java*):
- init: add java-basic / java-agentscope templates (pom.xml, Agent.java,
  eclipse-temurin Dockerfile). Basic template main() now reads PORT/HOST
  env so dev can spawn it without a launcher.
- config: detect_dependency_file() now recognizes pom.xml; generate_dockerfile
  emits the Java Dockerfile for Java agents.
- dev: new dev_java.py -- mvn compile + build-classpath, assemble classpath,
  spawn "java -cp <cp> <mainClass>" via @argfile (bypasses cmdline length
  limits), poll /ping for readiness, 750ms source-mtime poll hot reload with
  process-group termination. No DevServerLauncher -- zero Java CLI code needed.
- deploy: run "mvn -DskipTests package" before docker build for Java agents
  so the Dockerfile's "COPY target/<name>.jar" resolves.

Standalone binary:
- packaging/agentarts.spec: onefile bundle, collect_all for agentarts +
  huaweicloudsdkcore/agentidentity/iam/swr + uvicorn/starlette, hidden import
  six (huaweicloudsdk dynamic imports). Minimal set -- no fastapi/mcp.
- .github/workflows/release-binary.yml: ubuntu/windows/macos matrix build,
  per-command smoke test (all 9 commands --help), attach to GitHub Release.
- .gitignore: un-ignore packaging/agentarts.spec.

Verified: Java init->dev(hot reload)->invoke, Python regression, and a 30MB
binary running all 9 commands with no Python on PATH.
Add a curl|sh installer and document the standalone binary install path so
Linux/macOS users get a one-click install with no Python required.

- install.sh: detects OS/arch, downloads the matching Release asset, extracts
  the generic-named `agentarts` binary, installs to ~/.local/bin (or
  /usr/local/bin under sudo), prints PATH help, and notes the JDK+Maven
  prerequisite for Java agents. AGENTARTS_DOWNLOAD_URL / AGENTARTS_BIN_DIR
  overrides for mirrors/custom locations.
- release-binary.yml: add ubuntu-24.04-arm (linux/arm64) to the matrix;
  archive contains the generic name `agentarts` so the installer extracts a
  consistent binary name; Windows code-sign step moved before archiving and
  signs release/agentarts.exe.
- README: "Install the standalone CLI binary" subsection with the one-liner,
  manual-download table, and the Java toolchain caveat.

Verified the installer end-to-end against a local tarball (download, extract,
install, --version).
…jects

The "user has existing code, just wants a config" path goes through
`agentarts config`, not `init`. But `add_agent` built BaseConfig without
setting language/base_image, so they defaulted to python3/python:3.10-slim --
meaning a Java user who ran `agentarts config -e com.example.Agent
--dependency-file pom.xml` got language=python3, and `dev`/`deploy` would
not take the Java branch.

- add_agent: add a `language` param; when not given, infer from dependency_file
  (pom.xml -> java17) / entrypoint (no-colon dotted -> java17); set the
  matching base_image (eclipse-temurin:17-jre vs python:3.10-slim). Applies on
  both the new-agent and update paths.
- config command: add a --language/-l override; docstring now points existing-code
  users here (instead of init).
- helpers: infer_language(), default_base_image().

Verified: `agentarts config -n demo -e com.example.Agent --dependency-file pom.xml`
now yields language=java17 + base_image=eclipse-temurin:17-jre + Java Dockerfile;
requirements.txt yields python3 + python:3.10-slim + Python Dockerfile.
…tall

Close the Windows gap so all three platforms have a zero-prerequisite
one-command install, and document the uv (package-managed) path alongside.

- install.ps1: PowerShell equivalent of install.sh. Downloads the Windows
  zip from the latest GitHub Release, extracts agentarts.exe, installs to
  %LOCALAPPDATA%\Programs\agentarts, and adds the dir to the user PATH
  (persistent). Uses throw (not exit) on error so `irm | iex` reports the
  failure without closing the user's terminal. Same AGENTARTS_BIN_DIR /
  AGENTARTS_DOWNLOAD_URL env overrides as install.sh. JDK+Maven note for
  Java agents included.
- README "Install the standalone CLI binary": now lists Linux/macOS
  (curl|sh) and Windows (irm|iex) one-liners side by side, then an optional
  `uv tool install agentarts-sdk` section (isolated, upgradable; uv itself
  is a one-line install) for users who prefer a package-managed install.
  Manual-download table unchanged.

Note: install.ps1 was reviewed statically (PowerShell not available on the
dev machine); install.sh remains the live-tested path. The first GitHub
Release will exercise install.ps1 on Windows via the matrix smoke test.
@huaweiclouddev

Copy link
Copy Markdown
Member

🤖 Stale Bot

⏰ 已 60 天无活动,标记为过期。如有更新将自动取消。14 天后无活动将自动关闭。

集中管理 · 详见 治理规范

Add INITING ("Initing") to PingStatus so agents can report a
startup/loading phase via a custom @app.ping handler; the control
plane treats it as "wait, not ready to route traffic".

Also fix two status-resolution bugs:
- a custom ping handler that raises or returns an unrecognized value
  now fails safe to UNHEALTHY instead of silently reporting HEALTHY
- force_ping_status now takes precedence over the custom handler
  (graceful shutdown/maintenance) instead of being overwritten by it

Co-Authored-By: Claude Code <noreply@anthropic.com>
create_dockerfile() gained a required name argument in 74ae31e (the
Java templates render `COPY target/{name}.jar` from it), but the
unit tests were not updated and failed with TypeError. Pass name in
the three stale call sites and add a Java-template case covering the
jar copy the parameter exists for.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@Zhiyue-Wang
Zhiyue-Wang merged commit af2cbfc into main Nov 13, 2026
6 checks passed
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.

2 participants