Skip to main content

Overview

What is an Agent

An Agent (intelligent entity) is an AI application capable of autonomously executing tasks, interacting with users, and invoking external tools. Unlike traditional conversational AI, Agents have the following core capabilities:

  • Autonomous Decision-Making: Plans and executes steps autonomously based on user input and context
  • Tool Invocation: Calls external APIs, databases, search engines, and other tools to complete tasks
  • Multi-turn Interaction: Supports complex multi-turn conversations and state management
  • Streaming Output: Returns thinking processes and execution results in real-time streams

Technology Selection

CloudBase currently supports adapters for the following Agent frameworks:

Framework Options

FrameworkLanguage SupportFeaturesUse Cases
LangChainTypeScript/PythonMature, stable, rich ecosystemGeneral-purpose Agent development
LangGraphTypeScript/PythonGraph-structured workflows, fine-grained controlComplex multi-step tasks
CrewAIPythonMulti-Agent collaborationTeam collaboration tasks

Deployment Options

OptionFeaturesDevelopment LanguageUse Cases
HTTP Cloud FunctionsFast deployment, pay-as-you-go billing, auto-scalingJavaScript/TypeScript/PythonLightweight Agents, low-frequency invocations
CloudBase RunLong connections, custom runtimesContainer-based, supports any programming languageComplex Agents, high-concurrency scenarios

Development Workflow

1. Choose a Development Framework

Select the appropriate Agent framework based on your project requirements:

  • Need to quickly develop a general-purpose Agent → LangChain
  • Need complex workflow control → LangGraph
  • Need multi-Agent collaboration → CrewAI

2. Develop Agent Logic

Use the Agent adapter provided by CloudBase to integrate the framework with the AG-UI protocol:

// LangChain Example
import { LangchainAgent } from "@cloudbase/agent-adapter-langchain";
import { createAgent as createLangchainAgent } from "langchain";

// Create LangChain Agent
const lcAgent = createLangchainAgent({ model, checkpointer });

// Wrap as AG-UI compatible Agent
const agent = new LangchainAgent({
agent: lcAgent,
});

3. Deploy to CloudBase

Choose the appropriate deployment option:

4. Client Integration

Invoke the Agent from various clients:

AG-UI Protocol

CloudBase Agents are fully compatible with the AG-UI Protocol, a standardized front-end and back-end communication protocol that supports:

  • SSE Streaming: Real-time transmission of Agent execution processes
  • Tool Invocation: Unified calling standards for front-end and server-side tools
  • Human-Machine Interaction: Supports user confirmation, input, and other interaction scenarios
  • State Synchronization: Real-time synchronization of Agent state with clients

Quick Start

Prerequisites

  1. CloudBase environment activated
  2. Node.js 18+ or Python 3.9+ installed
  3. Large model configured (see Large Model Configuration Guide)
  4. API Key created (Get it here)

5-Minute Quick Experience

# 1. Install dependencies
npm install @cloudbase/agent-adapter-langchain @cloudbase/agent-server langchain @langchain/openai @langchain/langgraph express

# 2. Set environment variables
export TCB_ENV_ID=your-env-id # CloudBase environment ID
export TCB_API_KEY=your-api-key # CloudBase API Key
export TCB_AI_MODEL=hunyuan-turbos-latest # Model name

# 3. Create Agent
cat > index.js << 'EOF'
const { LangchainAgent } = require("@cloudbase/agent-adapter-langchain");
const { createExpressRoutes } = require("@cloudbase/agent-server");
const { createAgent: createLangchainAgent } = require("langchain");
const { ChatOpenAI } = require("@langchain/openai");
const { MemorySaver } = require("@langchain/langgraph");
const express = require("express");

const checkpointer = new MemorySaver();

function createAgent() {
// Use CloudBase's built-in large model endpoint
const model = new ChatOpenAI({
model: process.env.TCB_AI_MODEL || "hunyuan-turbos-latest",
apiKey: process.env.TCB_API_KEY,
configuration: {
baseURL: `https://${process.env.TCB_ENV_ID}.api.tcloudbasegateway.com/v1/ai/hunyuan/v1`,
},
});
const lcAgent = createLangchainAgent({ model, checkpointer });

return {
agent: new LangchainAgent({ agent: lcAgent }),
};
}

const app = express();
createExpressRoutes({ createAgent, express: app });
app.listen(3000, () => console.log("Agent running on http://localhost:3000"));
EOF

# 4. Run locally
node index.js

Visit http://localhost:3000 to experience the Agent.

tip

CloudBase has built-in support for Tencent Hunyuan and DeepSeek large models — no external API key required. For details, see Large Model Configuration Guide.

Next Steps