ibot Introduction
What is ibot
An Agent with an AgentID prefix starting with "ibot-" is ibot.
ibot is implemented based on CloudBase Run for Functions. Developers gain full control over business logic to meet highly personalized requirements. Within functions, third-party models can be called, complex decision-making processes can be designed, and open-source Agent development frameworks can be utilized. This enables the implementation of Agent capabilities such as Perception (Perception), Planning (Planning), and Action (Action), thus better fulfilling personalized needs.
Developing an AI Agent based on cloud functions is a process of backend adapting to frontend. By implementing the agreed-upon API interfaces in cloud functions, adaptation and integration with the frontend can be achieved.

TCB Copilot is based on Built with AI's Agent construction capabilities
With the AI Agent development framework @cloudbase/aiagent-framework provided by TCB, only a few lines of code are needed to quickly implement a simple blank Agent based on CloudBase Run for Functions. The sample code is as follows:
const { IBot } = require("@cloudbase/aiagent-framework");
const { BotRunner } = require("@cloudbase/aiagent-framework");
const ANSWER = "Hello, I am an Agent, but I can only say this one sentence.";
/**
* @typedef {import('@cloudbase/aiagent-framework').IAbstractBot} IAbstractBot
*
* @class
* @implements {IAbstractBot}
*/
class MyBot extends IBot {
async sendMessage() {
return new Promise((res) => {
// Create a character array
const charArr = ANSWER.split("");
const interval = setInterval(() => {
// Periodically loop to take one character from the array
const char = charArr.shift();
if (typeof char === "string") {
// When characters are present, send an SSE message to the client
this.sseSender.send({ data: { content: char } });
} else {
// Terminate the timed loop when characters are exhausted
clearInterval(interval);
// End SSE
this.sseSender.end();
res();
}
}, 50);
});
}
}
/**
* For the complete type definition, see: https://docs.cloudbase.net/cbrf/how-to-writing-functions-code#%E5%AE%8C%E6%95%B4%E7%A4%BA%E4%BE%8B
* "{demo: string}" is an example type declaration for the event parameter. Please modify it according to actual circumstances.
* Type hints will take effect only after dependencies are installed with `pnpm install`.
*
* @type {import('@cloudbase/functions-typings').TcbEventFunction<unknown>}
*/
exports.main = function (event, context) {
return BotRunner.run(event, context, new MyBot(context));
};