Create and Configure an Agent
This guide explains how to create a product, create an AI agent, and deploy it to the product on the Tuya IoT Platform so that devices automatically use the agent after Activation. The official documentation is authoritative for platform-side procedures; this guide connects the steps and identifies the SDK interfaces involved:
| Step | Official documentation |
|---|---|
| Create a product | Create Products |
| Configure an AI agent | AI Agent Dev Platform |
| Deploy the agent to the product | Agent Deployment and Billing, AI Capabilities Development |
If you do not yet have a product PID and device authorization code (uuid + authkey), follow this guide first. These are prerequisites for using Agentic-kit. See the integration flow in the Introduction.
Prerequisites
- A registered Tuya IoT Platform account
- An understanding of your product's form factor (speaker, educational camera, robot, and so on)
Steps
1. Create a Product
- Log in to the Tuya IoT Platform.
- Go to Product > Product Development > Create Product.
- Select an appropriate product category and solution.
- Enter the product name and obtain the product PID (
product_key).
Only product solutions that support AI capabilities show Product AI Capabilities on the development page (these products have an AI label). If you select the wrong solution, there is nowhere to configure step 3. This is not a missing configuration setting: you must change the solution or category.
2. Configure an AI Agent
- Find AI Configuration or Agent Management on the product page.
- Create or link an AI agent.
- Configure the agent's basic parameters:
- System prompt
- TTS voice type
- Language settings
For detailed steps, see the official Tuya documentation: Create an Agent.
3. Deploy the Agent to the Product (Direct Device Connection)
Direct device connection corresponds to the official "Deploy for direct device connection" method: after a product is linked to an agent, devices authorized using that product's information automatically invoke the agent after Activation. There are three deployment entry points:
- My Agent > More Actions > Deploy Agents
- My Agent > Manage > Deploy Agents
- Quick deployment under Product Development > Function Definition > Product AI Capabilities
The full product-side flow is: Product > Product Development > select the product > Develop > 01 Function Definition > Product AI Capabilities > Add Agent. There are three ways to add an agent:
| Method | Description |
|---|---|
| Recommend Agents Based on Capabilities | Select an AI capability first; the platform then recommends corresponding agent templates |
| Select Tuya's Agent Applications | Official Tuya applications (AI pet care, AI energy, and so on), with no development required; the application must already be deployed to this product solution |
| Select Created Agent | An agent you created under your account; its status must be Released |
After adding the device-side agent, click Configure Audio to select the audio format and voice. The device has a separate declaration: tts.order.supports in session_attrs_json. See Configure Audio Formats.
Only one device-side agent can be deployed per product. The official table describes multiple-agent deployment for devices as "not currently supported; multiple agents planned." Multiple agents are supported on the panel side.
Link the agent to the product before purchasing modules or obtaining authorization codes, so that the generated codes also include AI agent access authorization. Devices without this flag are identified as standard devices, and their AI token consumption is not eligible for the basic waiver. See Agent Deployment and Billing.
4. Configure a Workflow (Optional)
Advanced features such as image understanding and structured output require a workflow. See Create a Workflow.
5. Obtain Authorization Codes
- Request test authorization codes (uuid + authkey) on the product page. See Obtain Authorization Codes.
- For large-scale shipments, contact Tuya sales to purchase authorization codes.
6. Use the Agent in Code
RTC TCP Client:
tai_config_t cfg = {
// ...
.agent_token = NULL, // NULL uses the product's default agent
// If there are multiple agents, specify a particular agent_token
};
RTC Client: Agent selection is determined by the product configuration when obtaining the session_token. You do not need to specify it in the SDK.
Agent Token
If a product is linked to multiple agents (for example, for different scenarios), you can switch between them through the agent_token field:
tai_config_t cfg = {
.agent_token = "specific_agent_token_here",
// ...
};
Obtain agent_token from the Agent Management page on the Tuya IoT Platform.
Considerations
- Each product can have one default agent; devices use it when
agent_tokenis not specified. - The device declares the downlink TTS audio format through
tts.order.supportsinsession_attrs_json. See Configure Audio Formats. - Workflow configuration changes take effect immediately, without reconnecting.
- Test authorization codes have usage-count and time limits.
- To have an agent proactively push a message when a device reports a particular DP, you must also configure device event rules and triggers. See Agent Triggers.