跳到主要内容

系统架构

Agentic-kit 是 AI 智能设备的端侧 SDK,负责设备与涂鸦云平台之间的 IoT 管理和 AI 实时通信。

Agentic-kit 系统架构图

模块说明

IoT 通信模块

负责设备与涂鸦 IoT Core 的连接与管理:

模块头文件协议职责
iot-clientiot_client.hHTTP / MQTT设备激活、MQTT 长连接、会话令牌获取、数据点上报
tuya-bletuya_ble_prov.hBLE蓝牙配网

RTC 通信模块

负责设备与 AI Foundation 的实时音视频通信:

模块头文件协议职责
rtc-tcp-clienttuya_ai.htRTC (TCP)AI 实时交互,源码级集成,PAL 可移植
rtc-clientstm_open.htRTC (UDP)AI 实时交互,预编译库形式,支持多平台

公共组件 / common

被 IoT 与 RTC 两条协议栈共享的底层基础库。此前各模块各自维护的 TLS 实现已统一收敛到此处(如 rtc-tcp-client 的 src/tai_tls.c 已删除):

组件源文件职责
共享 TLScommon/tls.c基于 mbedTLS 的 TLS-over-TCP 传输层,由 IoT(MQTT / HTTP)与 RTC(rtc-tcp-client)两栈共用
共享 RNGcommon/rng.c进程级唯一的 CTR-DRBG 随机数发生器,在启动时一次性播种,供全 SDK 复用

项目结构

├── modules/ # SDK 模块源码/库
│ ├── rtc-tcp-client/ # tRTC(Tuya 自研 RTC 协议)TCP 实现(源码)
│ │ ├── include/tuya_ai.h
│ │ └── src/
│ ├── rtc-client/ # tRTC(Tuya 自研 RTC 协议)UDP 实现(预编译库)
│ │ ├── include/stm_open.h
│ │ └── libs/
│ ├── iot-client/ # IoT 客户端(激活、MQTT、token)
│ │ ├── include/iot_client.h
│ │ └── libs/
│ └── tuya-ble/ # BLE 配网模块
├── examples/
│ ├── posix/ # macOS/Linux 示例
│ │ ├── ai/
│ │ │ ├── rtc-tcp-client/ # 使用 rtc-tcp-client 的语音聊天
│ │ │ └── rtc-client/ # 使用 rtc-client 的语音聊天
│ │ ├── pair/
│ │ │ ├── scan-by-device/ # 设备扫码配网
│ │ │ ├── scan-by-app/ # App 扫码配网
│ │ │ └── api-activate/ # OpenAPI 激活
│ │ └── res/ # 测试资源文件
│ └── esp-idf/ # ESP-IDF 示例
│ ├── ai/
│ │ └── rtc-tcp-client/ # ESP32 语音聊天
│ └── pair/
│ ├── pair-by-ble/ # BLE 蓝牙配网
│ └── scan-by-app/ # App 扫码配网
├── pal/ # Platform Abstraction Layer
├── common/ # 公共工具代码
├── third_party/ # 第三方库(mbedtls 等)
└── docs-site/ # 本文档站点