System Architecture

Agentic-kit is a device-side SDK for AI-powered smart devices. It handles IoT management and real-time AI communication between devices and the Tuya cloud platform.

AI device using Agentic-kit: BLE and QR-code App Provisioning, iot-client over HTTP/MQTT to IoT Core, and RTC modules over tRTC to AI Foundation

Schematic guide, not a screenshot: English recreation of the original architecture diagram, preserving its module groups and connection paths.

Module descriptions​

IoT communication modules​

These modules handle device connection to and management by Tuya IoT Core:

ModuleHeaderProtocolResponsibilities
iot-clientiot_client.hHTTP / MQTTDevice Activation, persistent MQTT connection, Session token retrieval, and Data Point Reports
tuya-bletuya_ble_prov.hBLEProvisioning over Bluetooth

RTC communication modules​

These modules handle real-time audio and video communication between devices and AI Foundation:

ModuleHeaderProtocolResponsibilities
rtc-tcp-clienttuya_ai.htRTC (TCP)Real-time AI interaction, source-level integration, and PAL portability
rtc-clientstm_open.htRTC (UDP)Real-time AI interaction, distributed as a precompiled library with multiplatform support

Shared components / common​

These low-level foundational libraries are shared by the IoT and RTC protocol stacks. TLS implementations previously maintained separately by each module have been consolidated here (for example, rtc-tcp-client's src/tai_tls.c has been removed):

ComponentSource fileResponsibilities
Shared TLScommon/tls.cThe mbedTLS-based TLS-over-TCP transport layer shared by the IoT (MQTT / HTTP) and RTC (rtc-tcp-client) stacks
Shared RNGcommon/rng.cThe single process-wide CTR-DRBG random number generator, seeded once at startup and reused throughout the SDK
Log facadecommon/log.h / common/log.cSDK-wide compile-time log ceiling and dispatch (AGENTIC_KIT_LOG_LEVEL / AGENTIC_KIT_LOG); see Compile-Time Configuration

Project structure​

├── modules/ # SDK module source code/libraries
│ ├── rtc-tcp-client/ # TCP implementation of tRTC (Tuya's proprietary RTC protocol), provided as source code
│ │ ├── include/tuya_ai.h
│ │ └── src/
│ ├── rtc-client/ # UDP implementation of tRTC (Tuya's proprietary RTC protocol), provided as a precompiled library
│ │ ├── include/stm_open.h
│ │ └── libs/
│ ├── iot-client/ # IoT client (Activation, MQTT, token)
│ │ ├── include/iot_client.h
│ │ └── src/
│ └── tuya-ble/ # BLE Provisioning module
├── examples/
│ ├── posix/ # macOS/Linux examples
│ │ ├── ai/
│ │ │ ├── rtc-tcp-client/ # Voice chat using rtc-tcp-client
│ │ │ └── rtc-client/ # Voice chat using rtc-client
│ │ ├── pair/
│ │ │ ├── scan-by-device/ # Provisioning by having the device scan a QR code
│ │ │ ├── scan-by-app/ # Provisioning by having the app scan a QR code
│ │ │ └── api-activate/ # OpenAPI Activation
│ │ └── res/ # Test resource files
│ └── esp-idf/ # ESP-IDF examples
│ ├── ai/
│ │ └── rtc-tcp-client/ # ESP32 voice chat
│ └── pair/
│ ├── pair-by-ble/ # Provisioning over BLE
│ └── scan-by-app/ # Provisioning by having the app scan a QR code
├── pal/ # Platform Abstraction Layer
├── common/ # Shared utility code
├── third_party/ # Third-party libraries (including mbedTLS)
└── docs-site/ # This documentation site
© 2026 Tuya Inc.Tuya Physical AI · Agentic-kit