mirror of
https://github.com/modelstudioai/cli.git
synced 2026-09-14 19:49:23 +08:00
Merge pull request #158 from modelstudioai/feat/cma-deployment
feat(managed-agent): add OpenAgentPack deployment support
This commit is contained in:
@@ -6,6 +6,12 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
||||
|
||||
[中文版](CHANGELOG.zh.md) · [README](README.md) · [Contributing](CONTRIBUTING.md)
|
||||
|
||||
## [1.17.0] - 2026-08-17
|
||||
|
||||
### Added
|
||||
|
||||
- **Native Bailian Managed Agent Deployments** — `deployments` declared in `agents.yaml` now materialize as native AgentStudio resources, with server-side cron schedules, local file resource uploads, archival through `destroy`, and migration of legacy emulated state on the next `apply`.
|
||||
|
||||
## [1.16.0] - 2026-08-17
|
||||
|
||||
> Full knowledge-base lifecycle management arrives in the CLI: create and configure knowledge bases, upload documents, tune chunks, and deploy retrieval/Q&A services — all from `bl knowledge` and `kscli`.
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
|
||||
[English](CHANGELOG.md) · [README](README.zh.md) · [参与贡献](CONTRIBUTING.zh.md)
|
||||
|
||||
## [1.17.0] - 2026-08-17
|
||||
|
||||
### 新增
|
||||
|
||||
- **百炼原生 Managed Agent Deployment** —— `agents.yaml` 中声明的 `deployments` 现在会创建原生 AgentStudio 资源,支持服务端 Cron 调度、本地文件资源上传、通过 `destroy` 归档,以及在下次 `apply` 时迁移旧版模拟 Deployment state。
|
||||
|
||||
## [1.16.0] - 2026-08-17
|
||||
|
||||
> CLI 迎来知识库全生命周期管理:从创建配置知识库、上传文档、调优切片,到部署检索/问答服务,均可通过 `bl knowledge` 与 `kscli` 完成。
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bailian-cli",
|
||||
"version": "1.16.0",
|
||||
"version": "1.17.0",
|
||||
"description": "CLI for Aliyun Model Studio (DashScope) AI Platform.",
|
||||
"keywords": [
|
||||
"agent",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bailian-cli-commands",
|
||||
"version": "1.16.0",
|
||||
"version": "1.17.0",
|
||||
"description": "Command library for bailian-cli products (knowledge, memory, media, …). See https://www.npmjs.com/package/bailian-cli for usage.",
|
||||
"homepage": "https://bailian.console.aliyun.com/cli",
|
||||
"bugs": {
|
||||
@@ -40,7 +40,7 @@
|
||||
"check": "vp check"
|
||||
},
|
||||
"dependencies": {
|
||||
"@openagentpack/sdk": "0.3.1",
|
||||
"@openagentpack/sdk": "0.3.2",
|
||||
"bailian-cli-core": "workspace:*",
|
||||
"bailian-cli-runtime": "workspace:*",
|
||||
"boxen": "catalog:",
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
version: "1"
|
||||
|
||||
providers:
|
||||
bailian:
|
||||
api_key: ${DASHSCOPE_API_KEY}
|
||||
base_url: ${BAILIAN_BASE_URL}
|
||||
|
||||
defaults:
|
||||
provider: bailian
|
||||
|
||||
environments:
|
||||
dev:
|
||||
config:
|
||||
type: cloud
|
||||
networking:
|
||||
type: unrestricted
|
||||
|
||||
agents:
|
||||
reporter:
|
||||
description: "Invalid deployment integration fixture"
|
||||
model: qwen3.7-max
|
||||
instructions: |
|
||||
Generate a concise engineering report from the mounted template.
|
||||
environment: dev
|
||||
|
||||
deployments:
|
||||
invalid-report:
|
||||
agent: reporter
|
||||
initial_events:
|
||||
- type: user.define_outcome
|
||||
rubric: "Report is concise and actionable."
|
||||
resources:
|
||||
- type: file
|
||||
source: ./report-template.md
|
||||
- type: file
|
||||
source: ./report-template.md
|
||||
mount_path: report-template.md
|
||||
- type: file
|
||||
source: ./report-template.md
|
||||
mount_path: /mnt/report-template.md
|
||||
@@ -0,0 +1,39 @@
|
||||
version: "1"
|
||||
|
||||
providers:
|
||||
bailian:
|
||||
api_key: ${DASHSCOPE_API_KEY}
|
||||
base_url: ${BAILIAN_BASE_URL}
|
||||
|
||||
defaults:
|
||||
provider: bailian
|
||||
|
||||
environments:
|
||||
dev:
|
||||
config:
|
||||
type: cloud
|
||||
networking:
|
||||
type: unrestricted
|
||||
|
||||
agents:
|
||||
reporter:
|
||||
description: "Deployment integration fixture"
|
||||
model: qwen3.7-max
|
||||
instructions: |
|
||||
Generate a concise engineering report from the mounted template.
|
||||
environment: dev
|
||||
|
||||
deployments:
|
||||
daily-report:
|
||||
agent: reporter
|
||||
description: "Native Bailian deployment"
|
||||
schedule:
|
||||
expression: "0 9 * * *"
|
||||
timezone: UTC
|
||||
initial_events:
|
||||
- type: user.message
|
||||
content: "Generate today's engineering report."
|
||||
resources:
|
||||
- type: file
|
||||
source: ./report-template.md
|
||||
mount_path: /mnt/report-template.md
|
||||
@@ -0,0 +1,3 @@
|
||||
# Engineering report
|
||||
|
||||
Summarize completed work, current risks, and next actions.
|
||||
@@ -1,7 +1,21 @@
|
||||
import { join } from "node:path";
|
||||
import { describe, expect, test } from "vite-plus/test";
|
||||
import { parseStdoutJson, runCommandE2e } from "./helpers.ts";
|
||||
import { e2eFixturesDir, parseStdoutJson, runCommandE2e } from "./helpers.ts";
|
||||
import { MANAGED_AGENT_ROUTES } from "./topic-routes.ts";
|
||||
|
||||
const AGENTS_DEPLOYMENT_YAML = join(e2eFixturesDir, "managed-agent", "agents-deployment.yaml");
|
||||
const AGENTS_DEPLOYMENT_INVALID_YAML = join(
|
||||
e2eFixturesDir,
|
||||
"managed-agent",
|
||||
"agents-deployment-invalid.yaml",
|
||||
);
|
||||
|
||||
const DEPLOYMENT_SAFETY_DIAGNOSTIC_CODES = [
|
||||
"bailian.deployment.initial_events.message_required",
|
||||
"bailian.deployment.file.mount_path.required",
|
||||
"bailian.deployment.file.mount_path.duplicate",
|
||||
];
|
||||
|
||||
/**
|
||||
* managed-agent:help / 缺参不依赖密钥;所有 mutation 命令的 --dry-run
|
||||
* 必须在构建 SDK runtime(凭证注入 / 联网 / 写盘)之前短路,因此同样不需要密钥。
|
||||
@@ -12,6 +26,102 @@ import { MANAGED_AGENT_ROUTES } from "./topic-routes.ts";
|
||||
*/
|
||||
|
||||
describe("e2e: managed-agent", () => {
|
||||
test("validate 接受原生 Bailian Deployment 配置", async () => {
|
||||
const { stdout, stderr, exitCode } = await runCommandE2e(MANAGED_AGENT_ROUTES, [
|
||||
"managed-agent",
|
||||
"validate",
|
||||
"--file",
|
||||
AGENTS_DEPLOYMENT_YAML,
|
||||
"--output",
|
||||
"json",
|
||||
]);
|
||||
expect(exitCode, stderr).toBe(0);
|
||||
const data = parseStdoutJson<{
|
||||
valid?: boolean;
|
||||
diagnostics?: Array<{ code?: string; severity?: string }>;
|
||||
}>(stdout);
|
||||
expect(data.valid).toBe(true);
|
||||
expect(data.diagnostics).not.toContainEqual(
|
||||
expect.objectContaining({ code: "bailian.deployment.schedule_unsupported" }),
|
||||
);
|
||||
});
|
||||
|
||||
test("plan --dry-run 通过 SDK planner 规划原生 Bailian Deployment", async () => {
|
||||
const { stdout, stderr, exitCode } = await runCommandE2e(MANAGED_AGENT_ROUTES, [
|
||||
"managed-agent",
|
||||
"plan",
|
||||
"--dry-run",
|
||||
"--file",
|
||||
AGENTS_DEPLOYMENT_YAML,
|
||||
"--output",
|
||||
"json",
|
||||
]);
|
||||
expect(exitCode, stderr).toBe(0);
|
||||
const data = parseStdoutJson<{
|
||||
actions?: Array<{
|
||||
action?: string;
|
||||
address?: { provider?: string; type?: string; name?: string };
|
||||
}>;
|
||||
diagnostics?: Array<{ code?: string; severity?: string }>;
|
||||
}>(stdout);
|
||||
expect(data.actions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
action: "create",
|
||||
address: {
|
||||
provider: "bailian",
|
||||
type: "deployment",
|
||||
name: "daily-report",
|
||||
},
|
||||
}),
|
||||
);
|
||||
expect(data.diagnostics).not.toContainEqual(
|
||||
expect.objectContaining({ code: "bailian.deployment.schedule_unsupported" }),
|
||||
);
|
||||
});
|
||||
|
||||
test("validate 拒绝会产生空消息或无效挂载路径的 Bailian Deployment", async () => {
|
||||
const { stdout, exitCode } = await runCommandE2e(MANAGED_AGENT_ROUTES, [
|
||||
"managed-agent",
|
||||
"validate",
|
||||
"--file",
|
||||
AGENTS_DEPLOYMENT_INVALID_YAML,
|
||||
"--output",
|
||||
"json",
|
||||
]);
|
||||
expect(exitCode).toBe(1);
|
||||
const data = parseStdoutJson<{
|
||||
valid?: boolean;
|
||||
diagnostics?: Array<{ code?: string; severity?: string }>;
|
||||
}>(stdout);
|
||||
expect(data.valid).toBe(false);
|
||||
for (const diagnosticCode of DEPLOYMENT_SAFETY_DIAGNOSTIC_CODES) {
|
||||
expect(data.diagnostics).toContainEqual(
|
||||
expect.objectContaining({ code: diagnosticCode, severity: "error" }),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test("plan --dry-run 在 Deployment 安全诊断失败时阻断计划", async () => {
|
||||
const { stdout, exitCode } = await runCommandE2e(MANAGED_AGENT_ROUTES, [
|
||||
"managed-agent",
|
||||
"plan",
|
||||
"--dry-run",
|
||||
"--file",
|
||||
AGENTS_DEPLOYMENT_INVALID_YAML,
|
||||
"--output",
|
||||
"json",
|
||||
]);
|
||||
expect(exitCode).toBe(1);
|
||||
const data = parseStdoutJson<{
|
||||
diagnostics?: Array<{ code?: string; severity?: string }>;
|
||||
}>(stdout);
|
||||
for (const diagnosticCode of DEPLOYMENT_SAFETY_DIAGNOSTIC_CODES) {
|
||||
expect(data.diagnostics).toContainEqual(
|
||||
expect.objectContaining({ code: diagnosticCode, severity: "error" }),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test("managed-agent apply --help 正常退出", async () => {
|
||||
const { stderr, exitCode } = await runCommandE2e(MANAGED_AGENT_ROUTES, [
|
||||
"managed-agent",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bailian-cli-core",
|
||||
"version": "1.16.0",
|
||||
"version": "1.17.0",
|
||||
"description": "Core SDK for bailian-cli. See https://www.npmjs.com/package/bailian-cli for usage.",
|
||||
"homepage": "https://bailian.console.aliyun.com/cli",
|
||||
"bugs": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "knowledge-studio-cli",
|
||||
"version": "1.16.0",
|
||||
"version": "1.17.0",
|
||||
"description": "Lightweight RAG CLI for Aliyun Model Studio — focused on knowledge-base retrieval.",
|
||||
"keywords": [
|
||||
"alibaba-cloud",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bailian-cli-runtime",
|
||||
"version": "1.16.0",
|
||||
"version": "1.17.0",
|
||||
"description": "Runtime framework for bailian-cli (createCli, registry, args, output, pipeline). See https://www.npmjs.com/package/bailian-cli for usage.",
|
||||
"homepage": "https://bailian.console.aliyun.com/cli",
|
||||
"bugs": {
|
||||
|
||||
Generated
+5
-5
@@ -113,8 +113,8 @@ importers:
|
||||
packages/commands:
|
||||
dependencies:
|
||||
'@openagentpack/sdk':
|
||||
specifier: 0.3.1
|
||||
version: 0.3.1
|
||||
specifier: 0.3.2
|
||||
version: 0.3.2
|
||||
bailian-cli-core:
|
||||
specifier: workspace:*
|
||||
version: link:../core
|
||||
@@ -464,8 +464,8 @@ packages:
|
||||
'@emnapi/core': ^1.7.1
|
||||
'@emnapi/runtime': ^1.7.1
|
||||
|
||||
'@openagentpack/sdk@0.3.1':
|
||||
resolution: {integrity: sha512-/5LDwtNSjd9wyYGK4Lg7soqMyoI98BxhUGL3wzN5qO5HfmZBJP0YyElOnjhHyPHbLRWF7RYmfeVdA/oyEBJWTg==}
|
||||
'@openagentpack/sdk@0.3.2':
|
||||
resolution: {integrity: sha512-FvMHtIMIVLASGlt5q4kYSpD7BK+LWwN8vwnsckmD1SvPlWc9wayzA04DXU98IM74Ep5/HAqIKmNL8JAMQoeX1g==}
|
||||
engines: {node: '>=18.17.0'}
|
||||
|
||||
'@oxc-project/runtime@0.129.0':
|
||||
@@ -1674,7 +1674,7 @@ snapshots:
|
||||
'@tybys/wasm-util': 0.10.1
|
||||
optional: true
|
||||
|
||||
'@openagentpack/sdk@0.3.1':
|
||||
'@openagentpack/sdk@0.3.2':
|
||||
dependencies:
|
||||
jszip: 3.10.1
|
||||
yaml: 2.9.0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: bailian-cli
|
||||
metadata:
|
||||
version: "1.16.0"
|
||||
version: "1.17.0"
|
||||
requires:
|
||||
bins: ["bl"]
|
||||
description: >-
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: bailian-finetune
|
||||
metadata:
|
||||
version: "1.16.0"
|
||||
version: "1.17.0"
|
||||
requires:
|
||||
bins: ["bl"]
|
||||
description: >-
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: bailian-gen
|
||||
metadata:
|
||||
version: "1.16.0"
|
||||
version: "1.17.0"
|
||||
requires:
|
||||
bins: ["bl"]
|
||||
description: >-
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
---
|
||||
name: bailian-managed-agent
|
||||
metadata:
|
||||
version: "1.16.0"
|
||||
version: "1.17.0"
|
||||
requires:
|
||||
bins: ["bl"]
|
||||
description: >-
|
||||
阿里云百炼托管 Agent 声明式基础设施入口:用户要创建agent、初始化 agents.yaml、校验或预览 agent 配置变更、
|
||||
创建/更新/销毁百炼托管 Agent、和托管 agent 对话、查会话事件历史、导入或取消跟踪远端资源时使用
|
||||
创建/更新/销毁百炼托管 Agent 或 Deployment、和托管 agent 对话、查会话事件历史、导入或取消跟踪远端资源时使用
|
||||
`bl managed-agent`。以 agents.yaml 为唯一事实源做 IaC:init 建脚手架、validate 离线校验、plan 预览 diff、
|
||||
apply / destroy 变更远端资源且必须带 `--yes`,务必先 plan 给用户看 diff 再让其确认。
|
||||
反触发:调用已上线的百炼应用/智能体走 bailian-app-call 或 `bl app`;宿主 agent 自身的记忆、技能、
|
||||
@@ -36,6 +36,26 @@ description: >-
|
||||
5. Destroy bl managed-agent destroy --yes # only after user confirmation
|
||||
```
|
||||
|
||||
## Deployment as IaC
|
||||
|
||||
Deployment 与 Agent 一样声明在 `agents.yaml` 中,并复用同一条 `validate → plan → apply → destroy` IaC 链路;
|
||||
CLI 不提供绕过 state 的命令式 Deployment CRUD。最小配置:
|
||||
|
||||
```yaml
|
||||
deployments:
|
||||
daily-report:
|
||||
agent: assistant
|
||||
initial_events:
|
||||
- type: user.message
|
||||
content: "Generate today's report."
|
||||
```
|
||||
|
||||
- `apply` 会在百炼创建原生 Deployment;`destroy` 会归档已跟踪的远端 Deployment。
|
||||
- `schedule` 会在 `apply` 后由百炼服务端执行。若旧流程已有外部 cron / CI,先检查 `plan`,避免重复触发。
|
||||
- `initial_events` 至少包含一个 `user.message` 或 `system.message`;`user.define_outcome` 在百炼会被丢弃并产生诊断。
|
||||
- 本地文件资源在 `apply` 时上传,`mount_path` 必须位于 `/mnt`,且归一化后不能重复。
|
||||
- 旧版模拟 Deployment 的 state 可能记录空 `remote_id`;升级后 `plan` 会显示 materialize 更新,确认后再 `apply`。
|
||||
|
||||
## Session interaction (chat with a deployed managed agent)
|
||||
|
||||
| Intent | Command |
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: bailian-protocol
|
||||
metadata:
|
||||
version: "1.16.0"
|
||||
version: "1.17.0"
|
||||
requires:
|
||||
bins: ["bl"]
|
||||
description: >-
|
||||
|
||||
Reference in New Issue
Block a user