メインコンテンツへスキップ
以下のコマンドはすべて、サインイン 済みで、対象のアプリの実行が管理者によって許可されていることを前提としています。

メッセージの送信

difyctl run app に位置引数としてメッセージを渡すと、チャットボット、チャットフロー、Agent、テキストジェネレーターのアプリにメッセージを送信できます。応答は stdout に出力されます。
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 で入力を 1 つの JSON オブジェクトとして渡します。出力は JSON として stdout に出力されます。
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 を付けると、最後にまとめて出力するのではなく、生成されるそばから応答を出力します。
difyctl run app 0a1b2c3d-4e5f-6789-abcd-ef0123456789 "Draft a launch announcement" --stream

会話の継続

各応答に続くヒントから会話 ID をコピーし、--conversation で渡すと、同じ会話を継続できます。この機能はチャットボット、チャットフロー、Agent のアプリで利用できます。ワークフローとテキストジェネレーターのアプリは会話状態を保持しません。
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 を付けると、パイプ処理しやすい生の JSON 応答を取得できます。
difyctl run app 0a1b2c3d-4e5f-6789-abcd-ef0123456789 "What are your business hours?" -o json | jq -r '.answer'