AI Agent Management
The tcb agent command has been available since v3.0.0.
The tcb agent command is used to manage CloudBase AI Agents (intelligent agents), supporting creation, querying, updating, and deletion. Each Agent is powered by SCF at the underlying layer for computational capabilities. The CLI uniformly encapsulates code upload, configuration, and lifecycle management.
CloudBase AI Agent is an intelligent agent running on SCF, suitable for AI application scenarios requiring long connections and long-running operations (default timeout 7200s).
tcb agent create
Create AI Agent.
tcb agent create --name <name> [options]
Parameters
| Parameter | Description | Default Value |
|---|---|---|
--name <name> | Agent name (required) | — |
-e, --env-id <envId> | Environment ID | — |
--agent-id <agentId> | Custom Agent ID (auto-generated if not provided) | — |
--code [path] | Local code path (if not provided, uses the current directory), automatically packaged and uploaded | Current directory |
--runtime <runtime> | Runtime version | — |
--timeout <seconds> | Timeout period (seconds) | 7200 |
--memory-size <mb> | Memory size (MB), 64 or 128–3072 | 128 |
--install-dep | Automatically install dependencies (used when deploying without node_modules) | — |
--ignore <patterns> | Ignore file patterns, comma-separated | .git,node_modules,.DS_Store |
--env <K=V,...> | Environment variables, in the format KEY1=VALUE1,KEY2=VALUE2 | — |
--json | Output JSON | — |
Example
# Simplest Creation (with code from the current directory)
tcb agent create --name my-agent -e my-env-id
# Specifying the Code Directory and Runtime
tcb agent create --name my-agent --code ./agent-code --runtime Nodejs20.19 -e my-env-id
# Passing environment variables (for Agent code to read)
tcb agent create --name my-agent \
--env "OPENAI_API_KEY=sk-xxx,MAX_TOKENS=4096" \
-e my-env-id
tcb agent list
View the created Agent list.
tcb agent list [options]
Parameters
| Parameter | Description | Default Value |
|---|---|---|
-e, --env-id <envId> | Environment ID | — |
--limit <n> | Items per page | 10 |
--offset <n> | Offset | 0 |
--json | Output JSON | — |
Example
tcb agent list -e my-env-id
# Pagination Viewing
tcb agent list --limit 5 --offset 10 -e my-env-id
tcb agent detail
View the details of a single Agent, containing the readiness status and configuration of the underlying SCF.
tcb agent detail <agentId> [options]
Example
tcb agent detail agent-xxx -e my-env-id
# JSON Output (Suitable for Script Readiness Status Checks)
tcb agent detail agent-xxx --json -e my-env-id
tcb agent update
Update Agent code or configuration.
tcb agent update <agentId> [options]
Parameters
| Parameter | Description |
|---|---|
--code [path] | Update the code (default: current directory) |
--runtime <runtime> | Update the runtime version |
--timeout <seconds> | Update the timeout period |
--memory-size <mb> | Update the memory size (MB) |
--install-dep | Automatically install dependencies |
--ignore <patterns> | Update ignore patterns |
--env <K=V,...> | Update environment variables |
-e, --env-id <envId> | Environment ID |
Example
# Update Code Only
tcb agent update agent-xxx --code ./new-agent-code -e my-env-id
# Updating Runtime and Timeout
tcb agent update agent-xxx --runtime Nodejs20.19 --timeout 3600 -e my-env-id
tcb agent delete
Delete the Agent and its underlying SCF/Cloud Run resources (irreversible).
tcb agent delete <agentId> [options]
Parameters
| Parameter | Description |
|---|---|
-y, --yes | Skip confirmation prompts (suitable for script/CI invocations) |
-e, --env-id <envId> | Environment ID |
--dry-run | Perform a dry run to preview the Agent and underlying resources to be deleted without actual execution |
Example
# Delete Upon Interactive Confirmation
tcb agent delete agent-xxx -e my-env-id
# Preview resources to be deleted (without actual execution)
tcb agent delete agent-xxx --dry-run -e my-env-id
# Skip confirmation (for script scenarios)
tcb agent delete agent-xxx --yes -e my-env-id
Deleting the Agent will also clean up the underlying SCF resources. This operation cannot be undone. It is recommended to preview using --dry-run first.