Metadata-Version: 2.4
Name: tinet-agent-cli
Version: 0.1.0.dev37
Summary: Tinet Agent CLI Orchestrator
Requires-Python: >=3.12
Requires-Dist: filelock<4.0.0,>=3.32.5
Requires-Dist: httpx>=0.27.0
Requires-Dist: jsonschema<5.0.0,>=4.23.0
Requires-Dist: pyyaml<7.0.0,>=6.0.2
Requires-Dist: typer<0.27.0,>=0.26.0
Provides-Extra: dev
Requires-Dist: build>=1.2.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: twine>=5.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# TACO：智能体平台 CLI

TACO（Tinet Agent CLI Orchestrator）是天润智能体平台的命令行工具，可供开发者、自动化
流水线，以及 Cursor、Codex、Claude Code 等 AI Agent 使用。

它将智能体、应用和智能知识库能力组织成稳定、可发现的命令，并同时提供人工可读输出与 JSON
输出。

## 主要能力

- 使用 profile 管理和切换企业授权
- 查询、创建和管理智能体应用
- 从应用模板创建应用
- 拉取、校验、调试和发布智能体 DSL
- 管理 Workflow、Chatflow 和智能体工具
- 发现并调用 Agent OpenAPI
- 发现并调用智能知识库 OpenAPI，包括文档上传
- 向 AI Agent 提供命令、参数、场景和 Schema 的结构化说明

## 安装

要求 Python 3.12 或更高版本。推荐使用 `pipx` 安装：

```bash
pipx install tinet-agent-cli
taco --version
```

也可以使用 `pip`：

```bash
python -m pip install tinet-agent-cli
```

## 配置授权

使用前需要准备开发者中心 AccessKeyId 和 AccessKeySecret，并为接口密钥分配“智能体 > CLI
授权”权限。

CLINK2 endpoint 示例：

- 北京平台：`https://api-bj.clink.cn`
- 上海平台：`https://api-sh.clink.cn`

创建 profile：

```bash
TACO_ACCESS_KEY_SECRET='<access-key-secret>' taco profile set \
  --name clink-bj \
  --endpoint https://api-bj.clink.cn \
  --access-key-id '<access-key-id>'
```

列出 Zenava 和 TACO profile。带 `current=true` 的配置会优先展示，Zenava 当前配置排在 TACO
当前配置之前：

```bash
taco --json profile list
```

多企业场景可以列出、切换 profile，或为单次命令指定 profile：

```bash
taco profile list
taco profile use clink-bj
taco --profile clink-sh --json agent app list
```

## 智能体

### 应用与模板

```bash
taco agent app list --limit 20
taco --json agent app get <app-id>
taco agent app tag list --keyword 客服
taco agent app template list
taco agent app template create <template-app-id> --name 新应用 --yes
```

### 智能体 DSL

```bash
taco agent create \
  --name 示例智能体 \
  --category <category-code> \
  --output agent.json \
  --yes

taco agent pull <app-id> --output agent.json
taco agent validate --dsl agent.json
taco agent publish <app-id> --dsl agent.json --yes
```

模型、分类、Workflow、Chatflow、工具和内置示例可以从 `taco agent --help` 继续发现。

### Agent OpenAPI

```bash
taco agent operation search <关键词>
taco agent operation describe <operation-id>
taco --json agent call <operation-id> --param key=value
```

## 智能知识库

```bash
taco aikb operation search <关键词>
taco aikb operation describe <operation-id>
taco --json aikb call <operation-id> --param key=value
```

复杂参数可以通过 `--params-file` 或 `--body-file` 提供。文档上传 operation 支持使用 `--file`
指定本地文件，由 TACO 完成上传流程。

## 提供给 AI Agent 使用

AI Agent 或 CI 推荐使用 `--json --no-input`，避免依赖终端文本或等待交互输入：

```bash
taco --json --no-input profile list
taco --json --no-input agent app list --limit 10
taco --json --no-input aikb operation search 文档
```

TACO 可以输出完整命令契约及内置场景：

```bash
taco help -o json
taco agent scenario list -o json
taco agent schema list -o json
```

推荐先搜索候选 operation，再查看参数契约，最后执行调用。远端创建、修改、删除、上传和发布
操作应先取得用户批准，再显式传入 `--yes`。

## 安全提示

- 不要把 AccessKeySecret 或 token 写入代码、DSL、日志和对话内容。
- 优先通过隐藏输入、环境变量或 CI 密钥管理提供 AccessKeySecret。
- 写操作前确认当前 profile、目标资源和变更范围。
- 自动化程序应判断退出码、`ok` 和 `error.code`。
