> ## Documentation Index
> Fetch the complete documentation index at: https://enterprise-docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 常见任务

> 复制即用的命令，涵盖作为外部 SSO 用户最常运行的任务

以下所有命令均假设你已 [登录](/zh/3.11.x/develop/cli/sso-users/authenticate)，并且管理员已允许你运行目标应用。

## 发送消息

把消息作为位置参数传给 [`difyctl run app`](/zh/3.11.x/develop/cli/reference/apps#运行应用)，即可向聊天助手、对话流、Agent 或文本生成应用发送消息。回复会打印到 stdout。

```bash theme={null}
difyctl run app 0a1b2c3d-4e5f-6789-abcd-ef0123456789 "What are your business hours?"

# save just the reply to a file; hints and errors go to stderr, not stdout
difyctl run app 0a1b2c3d-4e5f-6789-abcd-ef0123456789 "Summarize this week's tickets" > reply.txt
```

## 运行工作流

用 [`--inputs`](/zh/3.11.x/develop/cli/reference/apps#运行应用) 把输入作为单个 JSON 对象传入，而不是传位置消息参数。输出会以 JSON 形式打印到 stdout。

```bash theme={null}
difyctl run app 7f3e9a2b-1c4d-4e8f-9a0b-2d5c8e1f4a7b --inputs '{"topic":"quarterly report"}'

# read large input sets from a file instead
difyctl run app 7f3e9a2b-1c4d-4e8f-9a0b-2d5c8e1f4a7b --inputs-file inputs.json
```

## 流式输出长响应

加上 [`--stream`](/zh/3.11.x/develop/cli/reference/apps#运行应用)，响应会边生成边打印，而不是在最后一次性输出。

```bash theme={null}
difyctl run app 0a1b2c3d-4e5f-6789-abcd-ef0123456789 "Draft a launch announcement" --stream
```

## 继续对话

从每条回复后的提示中复制对话 ID，再用 [`--conversation`](/zh/3.11.x/develop/cli/reference/apps#运行应用) 把它传回，即可继续同一段对话。此功能适用于聊天助手、对话流和 Agent 应用；工作流和文本生成应用不维护对话状态。

```bash theme={null}
difyctl run app 0a1b2c3d-4e5f-6789-abcd-ef0123456789 "What are your business hours?"
# hint: continue this conversation with --conversation 4f7d8c2a-9b1e-4c6d-8a3f-5e2b7c9d0a1f

difyctl run app 0a1b2c3d-4e5f-6789-abcd-ef0123456789 "And on weekends?" --conversation 4f7d8c2a-9b1e-4c6d-8a3f-5e2b7c9d0a1f
```

## 获取 JSON 输出用于脚本

为任意命令加上 [`-o json`](/zh/3.11.x/develop/cli/reference/output-formats-and-exit-codes)，即可获得便于管道处理的原始 JSON 响应。

```bash theme={null}
difyctl run app 0a1b2c3d-4e5f-6789-abcd-ef0123456789 "What are your business hours?" -o json | jq -r '.answer'
```
