TencentCloud/tencentcloud-agentobs-sdk-dsh
tencentcloud-agentobs-sdk-dsh 是一个 DeepSeek Harness (DSH) 可观测插件,直接将 GenAI trace 数据上报到腾讯云日志服务 (CLS)。它观察 DSH 原生的 session、agent loop、LLM stream 和 tool 生命周期,将其转换为腾讯云AI Agent可观测规范的5层 span 层级模型(entry → agent → step → chat → tool),并通过 tencentcloud-cls-sdk-js 直接上报到 CLS,无需额外部署 OTLP 收集器或 sidecar。
项目介绍Project Overview
DSH 可观测插件,将 session、agent loop、LLM stream、tool 生命周期转换为腾讯云AI Agent观测规范的 5 层 span 模型(entry→agent→step→chat→tool),通过 tencentcloud-cls-sdk-js 直接上报 CLS,无需 OTLP 收集器。适用于 DSH 全 profile(web/headless/harness)使用 CLS 后端做 GenAI 调用链追踪与排障。需注意:内容捕获默认开启,prompts、responses、tool 参数与结果会上报 CLS,敏感场景应将 captureContent 设为 false。
This DSH observability plugin converts DeepSeek Harness session, agent loop, LLM stream, and tool lifecycle events into the Tencent Cloud AI Agent observability 5-layer span model (entry → agent → step → chat → tool), uploading traces directly to CLS via tencentcloud-cls-sdk-js without OTLP collectors or sidecars. Use it to trace GenAI calls across the web, headless, and harness profiles when CLS is your backend. Caveat: content capture is on by default, so prompts, responses, and tool payloads are sent to CLS—set captureContent to false for sensitive workloads.
请帮我了解并安装插件:【tencentcloud-agentobs-sdk-dsh】【https://github.com/TencentCloud/tencentcloud-agentobs-sdk-dsh】
把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.
或使用命令行安装(适合开发者)Or use CLI install (for developers)
命令行安装CLI Install
dsh plugin --profile web add tencentcloud-agentobs-sdk-dsh
把 TencentCloud/tencentcloud-agentobs-sdk-dsh 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
Tencent Cloud Service CLS observability for DeepSeek Harness
English | 简体中文
tencentcloud-agentobs-sdk-dsh 是一个 DeepSeek Harness (DSH) 可观测插件,直接将 GenAI trace 数据上报到腾讯云日志服务 (CLS)。
它观察 DSH 原生的 session、agent loop、LLM stream 和 tool 生命周期,将其转换为腾讯云AI Agent可观测规范的 5 层 span 层级模型(entry → agent → step → chat → tool),并通过 tencentcloud-cls-sdk-js 直接上报到 CLS,无需额外部署 OTLP 收集器或 sidecar。
数据模型
DSH session/event + llm/stream
│
▼
CLS Trace Coordinator
│
▼
CLS 5-layer span model
(entry/agent/step/chat/tool)
│
▼
tencentcloud-cls-sdk-js
│ Protobuf upload
▼
Tencent Cloud CLS
一次 DSH turn 产生的 trace 结构:
ENTRY
└── AGENT (invoke_agent)
└── STEP (react round_N)
├── CHAT (chat model_name)
└── TOOL (execute_tool tool_name)
安装
前置依赖
全局安装 DeepSeek Harness CLI:
npm install -g @deepseek-ai/dsh
安装插件
dsh plugin --profile web add tencentcloud-agentobs-sdk-dsh
dsh plugin --profile headless add tencentcloud-agentobs-sdk-dsh
dsh plugin --profile harness add tencentcloud-agentobs-sdk-dsh
注意:安装或更新插件后,需要重启 DSH 服务才能生效。
pnpm 构建脚本问题
pnpm v9+ 默认禁止依赖包运行 install 脚本。如果安装时遇到以下错误:
[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: protobufjs@6.11.6
Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts.
在对应 profile 目录执行一次即可(后续安装/更新不再需要):
cd ~/.dsh/profiles/web
echo "enable-scripts=true" >> .npmrc
pnpm install
headless / harness profile 同理,将路径改为 ~/.dsh/profiles/headless 或 ~/.dsh/profiles/harness。
卸载插件
dsh plugin --profile web remove tencentcloud-agentobs-sdk-dsh
dsh plugin --profile headless remove tencentcloud-agentobs-sdk-dsh
dsh plugin --profile harness remove tencentcloud-agentobs-sdk-dsh
配置
环境变量(推荐)
export CLS_ENDPOINT=ap-guangzhou.cls.tencentcs.com
export CLS_TOPIC_ID=your-topic-id
export CLS_SERVICE_NAME=dsh-agent
# 鉴权方式二选一:
# 方式 1(强鉴权):SecretId + SecretKey
export CLS_SECRET_ID=your-secret-id
export CLS_SECRET_KEY=your-secret-key
# 方式 2(免鉴权/弱鉴权):仅提供纯数字 UIN
# export CLS_UIN=your-uin
dsh --profile web
插件配置文件
编辑 $DSH_HOME/profiles/<profile>/cordis.patch.yml:
- id: cls-observability
config:
endpoint: ap-guangzhou.cls.tencentcs.com
topicId: your-topic-id
# 强鉴权:SecretId + SecretKey
secretId: your-secret-id
secretKey: your-secret-key
# 或免鉴权(弱鉴权):仅提供纯数字 UIN(与 SecretId/SecretKey 二选一)
# uin: "100000000000"
serviceName: dsh-agent
captureContent: true
batchMaxSize: 32
flushIntervalMs: 5000
debug: false
显式插件配置优先于环境变量。
关闭内容捕获
默认情况下,prompts、responses、tool arguments/results 会附加到 span。如需关闭:
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=false
dsh --profile web
或在插件配置中设置 captureContent: false。
配置项
| 设置 | 默认值 | 说明 |
|---|---|---|
enabled |
true |
禁用采集但不卸载插件 |
endpoint |
CLS_ENDPOINT |
CLS API 接入点 |
topicId |
CLS_TOPIC_ID |
CLS 日志主题 ID |
secretId |
CLS_SECRET_ID |
腾讯云 SecretId(强鉴权,与 uin 二选一) |
secretKey |
CLS_SECRET_KEY |
腾讯云 SecretKey(强鉴权,与 uin 二选一) |
uin |
CLS_UIN |
免鉴权(弱鉴权)上报的腾讯云 UIN(纯数字,与 SecretId/SecretKey 二选一) |
serviceName |
deepseek-harness |
服务名 |
captureContent |
true |
捕获 prompts/responses/tool 内容(设为 false 关闭) |
contentMaxChars |
128000 |
单个内容属性最大字符数 |
batchMaxSize |
32 |
每批上报最大 span 数 |
maxQueueSize |
2048 |
队列上限,超限丢弃最旧 span |
flushIntervalMs |
5000 |
定时刷新间隔(毫秒) |
retryTimes |
3 |
上报重试次数 |
debug |
false |
启用调试日志 |
隐私说明
内容捕获默认开启。源代码、凭证、个人数据等敏感内容可能被发送到 CLS。如需关闭,设置 captureContent: false 或环境变量 OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=false。请确保 CLS 的数据保留和访问控制策略符合安全要求。
兼容性
| 组件 | 支持范围 |
|---|---|
| DeepSeek Harness | >=0.1.0-rc.6 <0.2.0 |
| Node.js | >=18.0.0 |
开发
pnpm install
pnpm run check
pnpm test
pnpm run build
nexu-io/open-design
ruvnet/ruflo
amruthpillai/reactive-resume
esengine/DeepSeek-Reasonix
volcengine/OpenViking
Molunerfinn/PicGo
titanwings/colleague-skill
nocobase/nocobase