環境変数

CLAUDE_AUTO_BACKGROUND_TASKS

1に設定すると、約2分以上実行されているエージェントタスクを強制的にバックグラウンドへ移動させます。

英語原文(公式ドキュメントより)

Set to 1 to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes

関連する変更履歴

v2.1.273(1件)

Fixed
サブエージェントが実行中にバックグラウンドへ移動された後(例: CLAUDE_AUTO_BACKGROUND_TASKS による移動)、SDK や --output-format stream-json の出力でそのサブエージェントの残りのメッセージと最終レポートが欠落する問題を修正した。
英語原文を表示
Fixed SDK and --output-format stream-json output dropping a subagent's remaining messages and final report after it is moved to the background mid-run (e.g. by CLAUDE_AUTO_BACKGROUND_TASKS)

変更前

サブエージェントが実行中に CLAUDE_AUTO_BACKGROUND_TASKS などでバックグラウンドへ移動されると、SDK や --output-format stream-json の出力で、そのサブエージェントの残りのメッセージと最終レポートが欠落していた。

変更後

サブエージェントが実行中にバックグラウンドへ移動されても、SDK および --output-format stream-json の出力で、その後のメッセージと最終レポートが欠落しなくなった。

ユーザーへの恩恵

ユーザーはサブエージェントがバックグラウンドに移動しても最終結果を見逃さず、完全な出力をそのまま後処理や記録に使える。

関連ドキュメント