主题
把你的应用部署到 LlamaCloud,并管理已有的部署。
部署名就是 NAME 列中显示的那个稳定 id。命令默认使用当前配置档的项目。在调用 API 的命令上传入 --project PROJECT,可以只对这一条命令覆盖它。
用量
终端窗口
llamactl deployments [COMMAND] [options]命令:
get [NAME]:列出部署,或查看某个部署create:从编辑器或 YAML 文件创建部署edit [NAME]:在编辑器中修改部署,或从 YAML 文件更新apply -f FILE:从 YAML 创建或更新部署template:打印一份新建部署用的 YAML 骨架delete NAME:删除部署delete -f FILE:删除 YAML 文件中写明的部署update NAME:重新解析 git ref 并开始一次新发布history NAME:查看发布历史rollback NAME:回滚到更早的 git SHAlogs NAME:获取或流式查看部署日志configure-git-remote NAME:配置推送模式的 git remote
请注意:
-o json与-o yaml供脚本使用。状态信息走 stderr,结构化数据走 stdout。- 在支持
-f的命令上,-f -表示从标准输入读取 YAML。 - apply 的 YAML 中
repo_url: ""表示推送模式。该部署会把代码存放在 LlamaCloud 的内部 git 仓库,而不是从外部 Git URL 拉取。
推送模式的自动推送
推送模式的命令可以把本地代码镜像到部署的内部 git 仓库。本地 git remote 的名字是 llamaagents-NAME。
create默认会配置该 remote 并推送。edit、apply与update只在当前仓库已拥有llamaagents-NAME这个 remote 时才自动推送。--push会配置 remote 并从当前仓库推送。--no-push跳过推送,使用服务端已有的代码。
在依赖自动推送之前,先用 llamactl deployments configure-git-remote NAME 把仓库关联好。
命令
Get
终端窗口
llamactl deployments get [NAME] [-o text|json|yaml|wide|template] [--project PROJECT]不带 NAME 时列出当前项目中的部署;带 NAME 时打印该部署。
输出模式:
text:默认的表格输出wide:带上较少用列的表格输出json:机器可读的 JSONyaml:机器可读的 YAMLtemplate:apply 形态的 YAML,且仅对单个部署可用
示例:
终端窗口
llamactl deployments get
llamactl deployments get invoice-agent -o yaml
llamactl deployments get invoice-agent -o template > deployment.yamlCreate
终端窗口
llamactl deployments create [-f FILE] [--no-push] [--project PROJECT]不带 -f 时,用带注释的 YAML 骨架打开 $EDITOR。保存并关闭文件即创建部署。
带 -f FILE 时,直接从 YAML 创建而不打开编辑器。用 -f - 从标准输入读取。
选项:
-f, --filename FILE:YAML 文件,或填-表示标准输入--no-push:推送模式部署跳过推送本地代码--project PROJECT:覆盖当前活动项目
示例:
终端窗口
llamactl deployments create
llamactl deployments create -f deployment.yaml
llamactl deployments create -f - < deployment.yaml
llamactl deployments create --no-push编辑
终端窗口
llamactl deployments edit [NAME] [-f FILE] [--push] [--no-push] [--project PROJECT]不带 -f 时,会先取回该部署、渲染成可编辑的 YAML,再打开 $EDITOR。在终端(TTY)里省略 NAME 时,会从现有部署中选择。脚本应当显式传入 NAME。
带 -f FILE 时,直接从 YAML 更新而不打开编辑器。若省略 NAME,YAML 中必须包含顶层的 name。
对于推送模式的部署,edit 只会在当前仓库已有 llamaagents-NAME remote 时才自动推送。传入 --push 可关联并推送当前仓库。
选项:
-f, --filename FILE:YAML 文件,或填-表示标准输入--push:即使尚未配置部署的 remote,也关联并推送当前仓库--no-push:推送模式部署跳过推送本地代码--project PROJECT:覆盖当前活动项目
示例:
终端窗口
llamactl deployments edit invoice-agent
llamactl deployments edit invoice-agent -f deployment.yaml
llamactl deployments edit -f deployment.yamlApply
终端窗口
llamactl deployments apply -f FILE [--dry-run] [--push] [--no-push] [--annotate-on-error] [--project PROJECT]以声明式方式应用部署 YAML。若顶层 name 已存在,apply 更新该部署;若不存在,则创建它。由 deployments template 或 deployments get NAME -o template 产出的 YAML 可直接用于本命令。
${VAR} 引用会在应用时从进程环境中解析。读取输出中被掩码的密钥值会被忽略,因此把部署来回导出再应用不会用占位符覆盖已有的密钥。
对于推送模式的更新,apply 只会在当前仓库已有 llamaagents-NAME remote 时自动推送。而推送模式的创建仍会默认配置 remote 并推送。
选项:
-f, --filename FILE:必填的 YAML 文件,或填-表示标准输入--dry-run:校验并打印解析后的载荷,不改动部署--push:即使尚未配置部署的 remote,也关联并推送当前仓库--no-push:推送模式部署跳过推送本地代码--annotate-on-error:把校验错误以注释的形式写回 YAML--project PROJECT:覆盖当前活动项目
示例:
终端窗口
llamactl deployments template > deployment.yaml
llamactl deployments apply -f deployment.yaml
llamactl deployments apply -f deployment.yaml --dry-run
llamactl deployments apply -f deployment.yaml --annotate-on-error
llamactl deployments get invoice-agent -o template | llamactl deployments apply -f -Template
终端窗口
llamactl deployments template打印一份新建部署用的带注释 YAML 骨架。该命令是离线的,不需要认证。它会尽量利用本地上下文,例如当前的 git remote、当前分支、部署配置路径与密钥名称。
示例:
终端窗口
llamactl deployments template > deployment.yamlDelete
终端窗口
llamactl deployments delete NAME [--project PROJECT]
llamactl deployments delete -f FILE [--project PROJECT]立即删除一个部署。可以直接传 NAME,也可以传 -f FILE 从 YAML 中读取部署名。
选项:
-f, --filename FILE:包含顶层name的 YAML 文件--project PROJECT:覆盖当前活动项目
示例:
终端窗口
llamactl deployments delete invoice-agent
llamactl deployments delete -f deployment.yamlUpdate
终端窗口
llamactl deployments update NAME [--git-ref REF] [--push] [--no-push] [--project PROJECT]重新解析该部署配置的 git ref,并从解析出的提交开始一次新发布。要在解析之前切到某个分支、标签或提交,请用 --git-ref。
对于推送模式的部署,update 只在当前仓库已配置好部署 remote 时才镜像本地代码。用 --push 关联并推送当前仓库;若只想重新部署服务端已有的那个版本,用 --no-push。
选项:
--git-ref REF:要部署的分支、标签或提交 SHA--push:即使尚未配置部署的 remote,也关联并推送当前仓库--no-push:推送模式部署跳过镜像本地代码--project PROJECT:覆盖当前活动项目
示例:
终端窗口
llamactl deployments update invoice-agent
llamactl deployments update invoice-agent --git-ref release-2026-05
llamactl deployments update invoice-agent --push
llamactl deployments update invoice-agent --no-pushHistory
终端窗口
llamactl deployments history NAME [-o text|json|yaml|wide] [--project PROJECT]按从新到旧展示某部署的发布历史。
示例:
终端窗口
llamactl deployments history invoice-agent
llamactl deployments history invoice-agent -o yamlRollback
终端窗口
llamactl deployments rollback NAME [--git-sha SHA] [--project PROJECT]把部署回滚到之前的某个 git SHA。在终端里省略 --git-sha 可以从发布历史中选择。脚本应当显式传入 --git-sha。
选项:
--git-sha SHA:要回滚到的 git SHA--project PROJECT:覆盖当前活动项目
示例:
终端窗口
llamactl deployments history invoice-agent
llamactl deployments rollback invoice-agent --git-sha 3f2a1c9
llamactl deployments rollback invoice-agentLogs
终端窗口
llamactl deployments logs NAME [--follow] [--json] [--tail N] [--since-seconds N] [--include-init-containers] [--project PROJECT]拉取最近的部署日志后退出。用 --follow 可持续流式输出。
选项:
--follow, -f:一直流式输出直到被中断--json:每行输出一个 JSON 日志事件--tail N:初次拉取的日志行数--since-seconds N:只返回晚于该秒数的日志--include-init-containers:包含 init 容器的日志--project PROJECT:覆盖当前活动项目
示例:
终端窗口
llamactl deployments logs invoice-agent
llamactl deployments logs invoice-agent --follow
llamactl deployments logs invoice-agent --tail 50 --since-seconds 3600
llamactl deployments logs invoice-agent --jsonConfigure Git Remote
终端窗口
llamactl deployments configure-git-remote NAME [--project PROJECT]为推送模式的部署配置一个带鉴权的 git remote。该 remote 名为 llamaagents-NAME。
执行之后,针对该部署的 deployments edit、deployments apply -f 与 deployments update 就能从当前仓库自动推送。
示例:
终端窗口
llamactl deployments configure-git-remote invoice-agent
git push llamaagents-invoice-agent另请参阅
- 入门:简介
- 配置名称、环境与界面:部署配置参考
- 本地开发服务:
llamactl serve