# AI Assistant

> **This solution leverages the Tuya Agent Platform**, which provides developers with foundational capabilities such as large language model invocation, knowledge base management, agent orchestration, and Workflow configuration, serving as the core infrastructure for building AI assistant solutions. The AI assistant solution integrates platform capabilities into mini-programs via the AI Assistant SDK in a modular form, enabling developers to rapidly construct AI applications with natural language interaction capabilities without needing to handle model invocation details.

## AI Assistant Introduction

AI Assistant is an intelligent dialogue mini-program provided by Tuya based on large language models, capable of accurately understanding user instructions and needs through voice or text input. It not only answers various user questions but also controls smart home devices, executes scheduled tasks, provides personalized recommendations, and many other functions. Through natural language interaction, AI Assistant creates a more convenient and intelligent living experience for users, becoming a smart butler in users' daily lives.

## Application Scenarios

- **Smart Home Control**: Users can give commands to the assistant through voice or text to control smart devices at home, such as "Turn on the living room light" or "Set the air conditioner to 26 degrees".
- **Information Queries**: Users can ask about weather, news, schedules, and other information, and the AI Assistant will provide accurate answers.
- **Personalized Recommendations**: Based on users' usage habits and preferences, it provides personalized suggestions such as energy-saving tips and comfort scene recommendations.
- **Scheduled Task Management**: Helps users set up and manage various scheduled tasks, such as "Open the curtains at 7 AM every day" or "Turn off all lights at 10 PM".

## Current Pain Points

- **Limited Customization and Extension Capabilities**: Tuya's agent mini-program provides personalization configurations such as name, icon, and theme color, but customization and extension capabilities are limited.
- **High Development Cost**: Developers need to understand agent-related APIs to develop, which has a steep learning curve.

## What is AI Agent SDK?

[AI Agent SDK](https://developer.tuya.com/material/library_oHEKLjj0/component?code=TAgent) is an SDK provided by Tuya to help developers integrate AI conversation functionality into their own mini-programs. It provides complete conversation interface, conversation logic management, and conversation data management capabilities.

### Version Notice

**⚠️ Important Notice**: `@ray-js/t-agent-plugin-assistant` has been deprecated, please use `@ray-js/t-agent-plugin-aistream` instead.

### Core Components

- **[@ray-js/t-agent](/en/miniapp/solution-ai/ability/general-ai-solution/aiAgentSolution/core-concept/t-agent)**: A general conversation framework that supports message sending and receiving, lifecycle management, and conversation data management, with a plugin mechanism.
- **[@ray-js/t-agent-plugin-aistream](/en/miniapp/solution-ai/ability/general-ai-solution/aiAgentSolution/core-concept/t-agent-plugin-aistream)**: A plugin that connects to the mini-program AI agent platform, supporting streaming conversations, speech recognition, and other features.
- **[@ray-js/t-agent-ui-ray](/en/miniapp/solution-ai/ability/general-ai-solution/aiAgentSolution/core-concept/t-agent-ray-ui)**: A conversation component library based on Ray UI, supporting virtual scrolling, internationalization, multimodal interaction, and other features.

## Core Features

- **Natural Language Understanding**: Able to understand users' colloquial expressions without requiring users to memorize specific command formats.
- **Multimodal Interaction**: Supports voice, text, image, video, and other input methods to meet usage needs in different scenarios.
- **Device Control**: Can control various smart devices within the Tuya ecosystem, achieving one-stop smart home management.
- **Scene Linkage**: Supports creating and executing complex scene linkages, such as "Home Mode", "Away Mode", etc.
- **Knowledge Base Queries**: Able to answer user questions about device usage, home management, and other aspects.
- **Personalized Recommendations**: Provides personalized suggestions and recommendations based on users' usage habits and preferences.
- **Speech Recognition**: Supports ASR speech recognition, accurately recognizing users' voice input.
- **Internationalization Support**: Built-in multi-language support, including 8 languages: Chinese, English, Japanese, German, French, Spanish, Italian, etc.

## AI Agent SDK vs. AI Agent Mini-Program

After creating an agent on Tuya's agent development platform and binding it to an App or PID, you can use the **AI Agent Mini-Program**, which provides personalization configurations such as name, icon, and theme color. However, if you need to integrate AI conversation into your own mini-program or deeply customize functionality and appearance, the **AI Agent SDK** is recommended.

### Comparison Analysis

| Feature | AI Agent Mini-Program | AI Agent SDK |
| --- | --- | --- |
| **Platform Integration** | Agent Development Platform | Agent Development Platform |
| **Device Control** | Supported | Supported |
| **Workflow** | Supported | Supported |
| **Knowledge Base** | Supported | Supported |
| **Form** | Independent Mini-Program | npm Package |
| **Development Method** | No code development required | Code development required |
| **Customization Capability** | Name, color, welcome message, background image | Interface and functionality fully customizable |
| **Integration Method** | Mini-program navigation | Can be embedded in your own mini-program |
| **Chart Drawing** | Not currently supported | Supported |
| **Card Functionality** | Not currently supported | Supports custom cards |
| **Multiple Agents** | Not currently supported | Supported |
| **Speech Recognition** | Not currently supported | Supports ASR speech recognition |
| **Internationalization** | Not currently supported | Supports multi-language internationalization |
| **Virtual Scrolling** | Not currently supported | Supports long list optimization |

If you want to quickly enable agent conversation functionality without complex customization, you can directly use the AI Agent Mini-Program. If you need to deeply integrate AI conversation into your own mini-program and perform personalized customization, the AI Agent SDK is a better choice.

## Billing Rules

During App usage, AI tokens or resources will be consumed. Please refer to [AI Agent Metering and Billing](https://developer.tuya.com/en/docs/iot/ai-agent-price?id=Kegb2s2shaj4d) for pricing rules. You can check specific usage by visiting [Resource Consumption](https://platform.tuya.com/ai/tokenUsage).
