Unlock Full AI Agent Control with CloudBase CLI V3: 15 New Commands & JSON Output
The article introduces CloudBase CLI V3, a redesign for AI agents that adds 15 top‑level commands, self‑explanatory help, JSON‑structured output, in‑terminal documentation, and demonstrates a complete end‑to‑end ticket‑system deployment using only the command line.
Background
AI agents such as Claude Code, Cursor and CodeBuddy can automate CloudBase operations (environment creation, function deployment, routing configuration). The traditional GUI console cannot be parsed or interacted with by agents, so a fully CLI‑driven workflow is required.
Why a New CLI?
GUI interactions rely on clicks, visual feedback and modal dialogs, which are invisible to agents. When a CLI cannot cover a step, the agent must pause for human intervention. CLI V3 is redesigned so that agents can perform the entire CloudBase lifecycle from the terminal without opening the console.
Key Improvements in V3
Added 15 top‑level command modules covering environment lifecycle, database, user permissions, routing, domain management, logs, AI agents and more.
All commands provide -h / --help output, enabling agents to discover functionality automatically.
Introduced tcb docs for in‑terminal documentation, removing the need for external searches.
Unified global --json flag that makes every command’s result machine‑readable structured data.
New Commands Overview
tcb env– create, modify, renew, destroy environments and query usage. tcb cors – manage security domain whitelist for Web SDK. tcb domains – bind custom domains and manage SSL certificates. tcb routes – configure HTTP routing (replaces tcb service). tcb user – create, query, modify, ban and delete users. tcb role – manage roles and permission policies. tcb permission – set resource‑level access permissions. tcb agent – manage AI agents (create, deploy, update, delete). tcb ai – unified entry for AI tools such as Claude Code, CodeBuddy, Codex, aider. tcb logs – unified log retrieval for functions, hosting, databases and large models. tcb api – generic pass‑through for any Tencent Cloud public API. tcb docs – search and read CloudBase documentation from the terminal. tcb app – one‑click application deployment (auto‑detect framework, install deps, build, upload, bind routes). tcb cloudrun – manage Cloud Run services (replaces tcb fun), supporting gray releases and traffic management. tcb secrets – manage temporary secret keys. tcb db – native NoSQL commands, MySQL execution, backup/restore, slow‑query monitoring.
Self‑Explanatory Help
Every command and sub‑command can display its full usage, parameter list and examples with -h or --help. Example: tcb fn deploy --help An agent can first run tcb --help to list top‑level commands, then query a specific command for details, all without external documentation.
Structured JSON Output
Adding the global --json flag removes progress bars, colors and human‑readable decorations, returning pure JSON that agents can parse directly.
Success example:
{"currentEnvId":"luke-personal-test-new-8d0d90f5f"}Error example:
{"error":{"code":"FUNCTION_NOT_FOUND","message":"函数 ai-reply 不存在","exit_code":4}}Exit Code Strategy
0– success, continue to next step. 1 – generic error, check command logic and switch strategy. 2 – authentication failure, trigger tcb login to re‑authenticate. 3 – parameter error, run --help to verify format. 4 – resource not found, verify resource name. 5 – cloud API error, retry later. 6 – local config file error, inspect cloudbaserc.json.
In‑Terminal Documentation
The tcb docs command lets agents list documentation modules, read a specific document, or perform a full‑text search.
tcb docs list</code><code>tcb docs read 云函数</code><code>tcb docs read https://docs.cloudbase.net/cloud-function/faq</code><code>tcb docs search 微信支付Practical Demo: Building an AI‑Powered Ticket System
The following workflow creates a complete ticket‑system project (database, four cloud functions, HTTP routing, user and permission management, custom domain binding and frontend deployment) using only CLI commands with --json for structured results.
Create and activate environment
tcb env create --alias "ticket-system-prod" --package baas_personal --yes --json</code><code>tcb env use luke-personal-test-new-8d0d90f5f --jsonInitialize database collections
tcb db nosql execute --command '{"CommandType":"COMMAND","TableName":"tickets","Command":"{\"createIndexes\":\"tickets\",\"indexes\":[{\"key\":{\"assignee\":1,\"status\":1},\"name\":\"assignee_status_1\"},{\"key\":{\"customerId\":1,\"createdAt\":-1},\"name\":\"customerId_createdAt_1\"}]}'}' --jsonDeploy cloud functions
tcb fn deploy submit-ticket --json</code><code>tcb fn deploy assign-ticket --json</code><code>tcb fn deploy reply-ticket --json</code><code>tcb fn deploy ai-reply --dir . --yes --jsonConfigure security rules and user permissions
tcb permission set collection:tickets \
--level custom \
--rule '{"read":"doc.customerId == auth.uid","write":"false"}' --yes --json</code><code>tcb user create ops-admin --password Secret123 --nickname "运营管理员" --json</code><code># Assign administrator role (replace ROLE_ID and USER_UID with actual values)</code><code>tcb role update --id ROLE_ID --add-users "USER_UID" --jsonSet up HTTP routing
tcb routes add -e luke-personal-test-new-8d0d90f5f --data '{"domain":"*","routes":[{"path":"/api/ai-reply","upstreamResourceType":"WEB_SCF","upstreamResourceName":"ai-reply","enable":true,"enableAuth":false}]}'Bind custom domain
tcb api ssl DescribeCertificates --json</code><code>tcb domains add luke.xxie.site --certid WZfHqLk2 --env-id luke-personal-test-new-8d0d90f5f --yes</code><code>tcb api dnspod CreateRecord --api-version 2021-03-23 --body '{"Domain":"xxie.site","SubDomain":"luke","RecordType":"CNAME","Value":"..."}'Deploy frontend cd frontend && tcb app deploy --yes After the final step the web application is accessible via the custom domain, and the entire lifecycle was performed with zero console clicks.
Conclusion
CloudBase CLI V3 provides an AI‑agent‑friendly interface: self‑describing commands, machine‑readable JSON output, structured exit codes and in‑terminal documentation. This enables agents to create, configure, deploy and operate a complete cloud project without any manual console interaction.
Tencent Cloud Developer
Official Tencent Cloud community account that brings together developers, shares practical tech insights, and fosters an influential tech exchange community.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
