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.

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:
| Module | Header | Protocol | Responsibilities |
|---|---|---|---|
| iot-client | iot_client.h | HTTP / MQTT | Device Activation, persistent MQTT connection, Session token retrieval, and Data Point Reports |
| tuya-ble | tuya_ble_prov.h | BLE | Provisioning over Bluetooth |
RTC communication modules
These modules handle real-time audio and video communication between devices and AI Foundation:
| Module | Header | Protocol | Responsibilities |
|---|---|---|---|
| rtc-tcp-client | tuya_ai.h | tRTC (TCP) | Real-time AI interaction, source-level integration, and PAL portability |
| rtc-client | stm_open.h | tRTC (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):
| Component | Source file | Responsibilities |
|---|---|---|
| Shared TLS | common/tls.c | The mbedTLS-based TLS-over-TCP transport layer shared by the IoT (MQTT / HTTP) and RTC (rtc-tcp-client) stacks |
| Shared RNG | common/rng.c | The single process-wide CTR-DRBG random number generator, seeded once at startup and reused throughout the SDK |
| Log facade | common/log.h / common/log.c | SDK-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