Skip to main content

Cloud Hosting Development and Deployment

CloudBase AI ToolKit has built-in support for cloud hosting development and deployment features. Cloud hosting enables you to easily deploy and run various backend services, supporting scenarios such as persistent connections, file uploads, and multi-language environments. This plugin is enabled by default—you simply need to tell the AI what you want to accomplish using natural language.

New Feature: AI Agent Development

Now supports developing AI Agents based on Function-based Cloud Hosting, enabling you to quickly create and deploy personalized AI applications.

When to Use Cloud Hosting

When you need to:

  • Real-time Communication: WebSocket, SSE, Streaming Responses
  • Long-running Tasks: Background Processing
  • Multi-language: Java, Go, PHP, Python, Node.js, etc.
  • AI Agent: Personalized AI Application Development

How to Choose Between Two Modes

Function-based: Recommended for beginners, supports Node.js, includes built-in WebSocket support, can be debugged locally with a fixed port 3000.

Container-based: Suitable for existing projects, supports any language, requires providing a Dockerfile.

Quick Start

1. Check Available Templates

List available cloud hosting templates

2. Create a New Project

Create a project named my-service using the helloworld template

3. Run Locally (Function-based)

Run my-service locally on port 3000

4. Deploy to the Cloud

Deploy my-service, enable public network access, with 0.5 CPU cores and 1GB memory

5. Create an AI Agent

Create an agent named my-agent for customer service dialogues

Common Scenarios

Mini Program Backend

Create a function-based service supporting WebSocket for the chat feature of Mini Programs

Java Spring Boot Application

Deploy a Spring Boot application to provide REST API services

Go Microservices

Create a high-performance microservice in Go to handle user authentication

Python Data Processing

Deploy a Python service to periodically process data and generate reports

PHP Laravel Application

Deploy a Laravel application to provide comprehensive web-based backend management.

AI Agent Applications

Create an agent to handle user inquiries and provide personalized services

Access to Your Service

After the deployment is complete, you can access it through the following methods:

Direct Invocation from Mini Program (Recommended):

const res = await wx.cloud.callContainer({
config: { env: "your-env-id" },
path: "/api/data",
method: "POST",
header: { "X-WX-SERVICE": "my-service" }
});

Web Application:

import cloudbase from "@cloudbase/js-sdk";
const app = cloudbase.init({ env: "your-env-id" });
const res = await app.callContainer({
name: "my-service",
method: "GET",
path: "/health"
});

Direct HTTP Access:

curl https://your-service-domain.com

AI Agent Development

Create an Agent

Create an agent named customer-service for customer service dialogues

Running Agents Locally

Run the customer-service agent locally on port 3000

Invoke Agents

// Invoking Web Applications
const app = cloudbase.init({ env: "your-env-id" });
const ai = app.ai();
const res = await ai.bot.sendMessage({
botId: "ibot-customer-service-demo",
msg: "msg: "Hello, I need help."
});
for await (let x of res.textStream) {
console.log(x);
}
# Command Line Testing
curl 'http://127.0.0.1:3000/v1/aibot/bots/ibot-customer-service-demo/send-message' \
-H 'Accept: text/event-stream' \
-H 'Content-Type: application/json' \
--data-raw '{"msg":"Hello"}'