Source profileQuality 96/100

TencentCloudBase/CloudBase-AI-Toolkit/config/source/skills/cloudbase-agent/py/skill.md

cloudbase-agent-python

Build production-ready AI agent backends using the CloudBase Agent Python SDK — create agents with LangGraph/CrewAI/LlamaIndex, serve them via FastAPI with AG-UI protocol streaming + OpenAI-compatible endpoints, add tools (bash, filesystem, MCP, code execution), memory (in-memory, TDAI, MySQL, MongoDB), observability (OpenTelemetry/Langfuse), and middleware (auth, logging). Use this skill when the user wants to create an AI agent server, build a chatbot backend, set up human-in-the-loop workflow

Source repository stars
1,066
Declared platforms
0
Static risk flags
1
Last source update
2026-08-04
Source checked
2026-08-04

Decision brief

What it does—and where it fits

Build production-ready AI agent backends with multi-framework support, streaming protocol, rich tools, persistent memory, and full observability.

Best for

  • Deploy AI agents as HTTP services with AG-UI protocol support
  • Build agent backends using LangGraph, CrewAI, or LlamaIndex frameworks
  • Create custom agent adapters implementing the AbstractAgent interface

Not for

  • Tasks that require unconfirmed production actions or broad system permissions.
  • Environments where the pinned source and install steps cannot be inspected.

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/TencentCloudBase/CloudBase-AI-Toolkit --skill "config/source/skills/cloudbase-agent/py"
Safe inspection promptEditorial

Inspect the Agent Skill "cloudbase-agent-python" from https://github.com/TencentCloudBase/CloudBase-AI-Toolkit/blob/1dddc898085c55ae616c3b0bf989b4b7b7797b35/config/source/skills/cloudbase-agent/py/skill.md at commit 1dddc898085c55ae616c3b0bf989b4b7b7797b35. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    How to use this skill (for a coding agent)

    1. Choose the right adapter - Use LangGraph adapter for stateful, graph-based workflows - Use CrewAI adapter for multi-agent collaboration patterns - Build custom adapter for specialized agent logic

    Choose the right adapterUse LangGraph adapter for stateful, graph-based workflowsUse CrewAI adapter for multi-agent collaboration patterns
  2. 02

    Adapter Selection (Step 0)

    Review the “Adapter Selection (Step 0)” section in the pinned source before continuing.

    Review and apply the “Adapter Selection (Step 0)” source section.
  3. 03

    Quick Start (Framework-Agnostic)

    Prerequisites: Python = 3.10 is required.

    Prerequisites: Python = 3.10 is required.1. Install dependencies (pick ONE adapter):
  4. 04

    When to use this skill

    Use this skill for AI agent development when you need to:

    Deploy AI agents as HTTP services with AG-UI protocol supportBuild agent backends using LangGraph, CrewAI, or LlamaIndex frameworksCreate custom agent adapters implementing the AbstractAgent interface
  5. 05

    Routing (Execution Order)

    ⚠️ Deployment is a BLOCKING 4-step pipeline. Steps marked ✅ BLOCKING must be completed AND verified before proceeding to the next step. Do NOT call manageAgent until all blocking steps pass.

    ⚠️ Deployment is a BLOCKING 4-step pipeline. Steps marked ✅ BLOCKING must be completed AND verified before proceeding to the next step. Do NOT call manageAgent until all blocking steps pass.

Permission review

Static risk signals and limitations

Network access

medium · line 117

The documentation includes network, browsing, or remote request actions.

Client (React / MiniProgram / curl)

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score96/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars1,066SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
TencentCloudBase/CloudBase-AI-Toolkit
Skill path
config/source/skills/cloudbase-agent/py/skill.md
Commit
1dddc898085c55ae616c3b0bf989b4b7b7797b35
License
MIT
Collected
2026-08-04
Default branch
main
View the original SKILL.md

CloudBase Agent Python SDK

Build production-ready AI agent backends with multi-framework support, streaming protocol, rich tools, persistent memory, and full observability.

Note: This skill is for Python projects only.

When to use this skill

Use this skill for AI agent development when you need to:

  • Deploy AI agents as HTTP services with AG-UI protocol support
  • Build agent backends using LangGraph, CrewAI, or LlamaIndex frameworks
  • Create custom agent adapters implementing the AbstractAgent interface
  • Understand AG-UI protocol events and message streaming
  • Build production-ready agent servers with FastAPI

Do NOT use for:

  • Simple AI model calling without agent capabilities (use ai-model-* skills)
  • CloudBase cloud functions (use cloud-functions skill)
  • CloudRun backend services without agent features (use cloudrun-development skill)
  • TypeScript/JavaScript agent projects (use cloudbase-agent skill, refer to the ts/ sub-directory)

How to use this skill (for a coding agent)

  1. Choose the right adapter

    • Use LangGraph adapter for stateful, graph-based workflows
    • Use CrewAI adapter for multi-agent collaboration patterns
    • Build custom adapter for specialized agent logic
  2. Write agent code — follow the adapter-specific doc from the Routing table

  3. Deploy the agent server — follow the blocking deployment pipeline in agent-deployment

Routing (Execution Order)

⚠️ Deployment is a BLOCKING 4-step pipeline. Steps marked ✅ BLOCKING must be completed AND verified before proceeding to the next step. Do NOT call manageAgent until all blocking steps pass.

StepTaskDocumentBlocking?
0Choose adapter & write agent codeSee "Adapter Selection" below
1Ensure Python 3.10agent-deployment § Step 1✅ BLOCKING
2Build env/ (one-shot)agent-deployment § Step 2✅ BLOCKING
3Verify env/ integrityagent-deployment § Step 3✅ BLOCKING
4Deploy with manageAgentagent-deployment § Step 4

Adapter Selection (Step 0)

FrameworkReadInstall
LangGraph (stateful graphs)adapter-langgraphcloudbase-agent-langgraph
CrewAI (multi-agent crews)adapter-developmentcloudbase-agent-crewai
Coze platformadapter-cozecloudbase-agent-coze
Custom / raw FastAPIserver-quickstart + adapter-developmentcloudbase-agent-server

Additional References (read on demand, NOT required for deployment)

TaskRead
Server setup, middleware, multi-agent, CORSserver-quickstart
Authentication and user contextauthentication

Quick Start (Framework-Agnostic)

Prerequisites: Python >= 3.10 is required.

1. Install dependencies (pick ONE adapter):

# Option A: LangGraph-based agent
pip install cloudbase-agent-langgraph

# Option B: CrewAI-based agent
pip install cloudbase-agent-crewai

# Option C: Custom / minimal
pip install cloudbase-agent-server

2. Create server entry point:

# server.py — this pattern works with ANY adapter
import os
from dotenv import load_dotenv
load_dotenv()

from cloudbase_agent.server import AgentServiceApp, AgentCreatorResult

# Import your agent (framework-specific, see adapter docs)
# from agents.chat.agent import create_my_agent

def create_agent() -> AgentCreatorResult:
    agent = create_my_agent()  # Your agent factory
    return {"agent": agent}

app = AgentServiceApp()
app.set_cors_config(allow_origins=["*"])

if __name__ == "__main__":
    port = int(os.environ.get("SCF_RUNTIME_PORT", "9000"))
    app.run(create_agent, port=port, host="0.0.0.0")

3. Deploy to CloudBase:

Follow the 4-step deployment pipeline in agent-deployment.


Architecture

Client (React / MiniProgram / curl)
   │  HTTP POST + SSE streaming
   ▼
┌─────────────────────────────────────────────┐
│  AgentServiceApp (FastAPI)                   │
│  ├─ /send-message      ← AG-UI SSE         │
│  ├─ /chat/completions  ← OpenAI-compat      │
│  └─ Middleware chain (onion model)           │
├─────────────────────────────────────────────┤
│  Agent Layer                                 │
│  ├─ LangGraphAgent  ├─ CrewAIAgent          │
│  ├─ LlamaIndexAgent ├─ CozeAgent/DifyAgent  │
│  └─ BaseAgent (extend for custom)           │
├──────────────────┬──────────────────────────┤
│  Tools           │  Storage                  │
│  Bash/FS/Code/MCP│  Memory + LongTermMemory  │
├─────────────────────────────────────────────┤
│  Observability (OpenTelemetry + Langfuse)    │
└─────────────────────────────────────────────┘

Installation

CloudBase Agent Python SDK is published to PyPI as separate packages. Note: PyPI package names use hyphens (cloudbase-agent-*), and Python imports use the same namespace (cloudbase_agent.*).

# Core + Server + LangGraph (most common)
pip install cloudbase-agent-langgraph

# Individual packages
pip install cloudbase-agent-core        # Core framework
pip install cloudbase-agent-server      # FastAPI server
pip install cloudbase-agent-langgraph   # LangGraph integration
pip install cloudbase-agent-tools       # Tool system
pip install cloudbase-agent-storage     # Memory/Storage
pip install cloudbase-agent-observability  # OpenTelemetry/Langfuse
pip install cloudbase-agent-coze        # Coze platform
pip install cloudbase-agent-crewai      # CrewAI integration

Import Note: All packages share the cloudbase_agent namespace:

# After installing cloudbase-agent-langgraph, import from cloudbase_agent
from cloudbase_agent.langgraph import LangGraphAgent
from cloudbase_agent.server import AgentServiceApp
from cloudbase_agent.tools import create_bash_tool

Reference Documents

Based on what the user needs, read the corresponding reference document. Only read the relevant reference — don't load all of them.

User NeedReferenceWhat It Covers
Deploying agent to CloudBaseRead agent-deploymentmanageAgent MCP tool (MUST USE), 4-step blocking pipeline, Python 3.10, env/ build, verification
Server setup, deployment, middleware, multi-agent, CORSRead references/server.mdAgentServiceApp 3 deployment methods, middleware (generator/yield/onion model), multi-agent server, Agent Creator pattern, health checks
LangGraph agent, callbacks, tool proxy, HITL, checkpointsRead adapter-langgraphLangGraphAgent constructor, AgentCallback protocol, ToolProxy, human-in-the-loop with interrupt(), TDAICheckpointSaver, client-defined tools
Tools: bash, filesystem, code execution, MCP, custom toolsRead references/tools.mdcreate_bash_tool, 8 file tools, code executors, MCPToolkit/CloudBaseMCPServer, @tool decorator, BaseTool, framework adapters
Memory, persistence, short/long-term, MySQL, MongoDBRead references/storage.mdInMemoryMemory, TDAIMemory, MySQLMemory, MongoDBMemory, TDAILongTermMemory, Mem0LongTermMemory, LangGraph checkpoint
Tracing, monitoring, Langfuse, OpenTelemetryRead references/observability.mdConsoleTraceConfig, OTLPTraceConfig, setup_observability, env vars, manual observation spans
Common patterns, JWT auth, MCP integration, productionRead references/recipes.mdJWT middleware, MCP + LangGraph, production deployment, adding tools to agents, client-defined tools

Key Imports Quick Reference

# Server
from cloudbase_agent.server import AgentServiceApp, AgentCreatorResult
from cloudbase_agent.server import create_send_message_adapter, create_openai_adapter
from cloudbase_agent.server import RunAgentInput, OpenAIChatCompletionRequest

# Agents
from cloudbase_agent.langgraph import LangGraphAgent
from cloudbase_agent.crewai import CrewAIAgent

# Tools
from cloudbase_agent.tools import create_bash_tool, create_read_tool, create_write_tool
from cloudbase_agent.tools import MCPToolkit, CloudBaseMCPServer, CloudBaseTool
from cloudbase_agent.tools import tool, BaseTool  # custom tools

# Storage
from cloudbase_agent.storage import InMemoryMemory, TDAIMemory
from cloudbase_agent.storage import TDAILongTermMemory, Mem0LongTermMemory
from cloudbase_agent.langgraph import TDAICheckpointSaver, TDAIStore

# Observability
from cloudbase_agent.observability import ConsoleTraceConfig, OTLPTraceConfig, setup_observability

# Schemas
from cloudbase_agent.schemas import Message, MessageRole, StreamEvent, EventType

Project Structure Convention

my-agent-project/
├── agents/
│   ├── agentic_chat/agent.py      # build_workflow() → agent instance
│   ├── human_in_the_loop/agent.py
│   └── __init__.py
├── server.py                       # Main entry: AgentServiceApp().run(...)
├── scf_bootstrap                   # CloudBase startup script (required for deployment)
├── .env                            # OPENAI_API_KEY, etc.
└── requirements.txt

Environment Variables

VariablePurpose
OPENAI_API_KEYOpenAI API key
AUTO_TRACES_STDOUTEnable console tracing (true)
LANGFUSE_PUBLIC_KEY / LANGFUSE_SECRET_KEYLangfuse keys
TDAI_ENDPOINT / TDAI_API_KEYTDAI memory/checkpoint endpoint
SCF_RUNTIME_PORTCloudBase runtime port (set automatically during deployment)

Key Design Decisions

  1. Agent Creator Pattern: Every request creates a fresh agent via factory function. Supports cleanup callbacks for resource release.
  2. Dual Protocol: Every agent supports both AG-UI native (SSE + rich events) and OpenAI-compatible (/chat/completions).
  3. Middleware = Generator: Use yield — pre-yield = pre-processing, post-yield = post-processing (onion model).
  4. Namespace Package: cloudbase_agent spans multiple PyPI packages (cloudbase-agent-core, cloudbase-agent-server, cloudbase-agent-langgraph, etc.). PyPI names use hyphens, but all imports use from cloudbase_agent.xxx import ....
  5. Observability Auto-Integration: Install cloudbase-agent-observability and tracing works automatically — zero config needed.
  6. Deploy with manageAgent: Always use the manageAgent MCP tool for CloudBase deployment. Follow the 4-step blocking pipeline in agent-deployment.

Alternatives

Compare before choosing