Metadata-Version: 2.4
Name: tinet-agent-cli
Version: 0.2.0
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: jsonpatch<2.0.0,>=1.33
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。

命令按 `taco <领域> <资源> <动作>` 组织。远端 Draft 是唯一编辑态；
默认 JSON 输出，默认非交互。发现命令请逐级使用原生 `--help`。

## 主要能力

- 使用 Profile 管理和切换多个企业环境
- 统一创建与管理 Agent、Chat、Chatflow、Workflow 应用
- 读取、校验、调试和发布远端 Draft
- 发现模型、分类、平台工具、Provider 凭据，以及可挂到 Draft 的知识库
- 查询会话、消息和节点追踪
- 通过参数化命令管理智能知识库

## 安装

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

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

也可以使用 `pip`：

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

## 命令结构

| 命令 | 用途 |
| --- | --- |
| `taco profile` | 查看 Zenava/TACO Profile，并管理 TACO Profile |
| `taco agent` | 智能体平台领域 |
| `taco aikb` | 智能知识库管理 |
| `taco upgrade` | 升级当前环境中的 TACO |

```bash
taco --help
taco agent --help
taco agent app draft update --help
taco aikb --help
```

全局参数只有 `--profile` 和 `--version`。默认 JSON 输出，默认非交互。

升级当前环境中的 TACO：

```bash
taco upgrade
```

## 诊断日志

CLI 默认写入脱敏 JSONL 日志：

- 默认路径：`~/.taco/logs/taco-YYYY-MM-DD.jsonl`
- 默认保留 14 天
- 环境变量：`TACO_LOG_LEVEL`（INFO/DEBUG）、`TACO_LOG_DIR`、`TACO_LOG_RETENTION_DAYS`
- 失败 JSON 含 `invocation_id`，用于在当天日志中排查
- 永不记录 Secret、凭据或明文 AccessKey

不提供日志全局命令行参数。

## 配置授权

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

CLINK2 endpoint 示例：

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

```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>'
```

```bash
taco profile list
taco profile use clink-bj
taco profile delete <profile-name> --yes
taco --profile clink-sh agent app list
```

## 推荐流程

```bash
taco agent app create --type agent --name demo --category <category-code>
taco agent schema get agent
taco agent dataset list --keyword 客服
taco agent dataset scope search --query MT --knowledge-type customer
taco agent app draft get <app-id>
taco agent app draft update <app-id> --from-stdin --expected-hash <hash> --yes
taco agent app draft run <app-id> --from-stdin --yes
taco agent app draft publish <app-id> --yes
taco agent app version list <app-id>
```

从模板创建：

```bash
taco agent app template list
taco agent app template create <template-app-id> --name <new-app-name>
```

## 运行数据

查询会话时可加 `--request-unique-id`，按接入方链路 ID 过滤；与 `--conversation-id` 相互独立。

```bash
taco agent data conversation list \
  --app-id <app-id> \
  --created-at-start <unix-seconds> \
  --created-at-end <unix-seconds> \
  --request-unique-id <request-unique-id>
taco agent data message list \
  --app-id <app-id> \
  --conversation-id <conversation-id> \
  --conversation-created-at <unix-seconds>
taco agent data trace list \
  --app-id <app-id> \
  --conversation-id <conversation-id> \
  --conversation-created-at <unix-seconds> \
  --message-id <message-id>
```

## 平台工具与知识库发现

```bash
taco agent tool list
taco agent tool get <provider-id> <tool-name>
taco agent category list
taco agent model list --category <category-code>
taco agent schema get agent
taco agent schema get chat
taco agent schema get chatflow
taco agent schema get workflow
taco agent dataset list --keyword <name>
taco agent dataset get <dataset-id>
taco agent dataset scope list
taco agent dataset scope search --query <keyword> --knowledge-type customer
taco agent dataset scope get --id <aikb-id> --type repository --knowledge-type customer
```

Draft 配置契约以 `taco agent schema` 为准。
`dataset` 用于填写 Draft 里的 `dataset_id` / `select_list`；文档内容管理用 `taco aikb`。

## 智能知识库

```bash
taco aikb repository list-public
taco aikb repository get-bot
taco aikb faq list --repository-id <id>
```
