What probably matters to youSection of the release
What
--bg starts a session as a background agent. --agents defines custom subagents (helper agents Claude can hand work to), either as JSON typed directly on the command line or as a file. If you combine --bg with the file form, Claude Code now stops with this error:
"--bg can't read --agents from a file: a background session is interactive, and the file form works only with --print. Pass the agents as inline JSON."
Why
The file form of --agents only works with --print, the non-interactive mode. If you start background sessions with custom subagents, write them out as inline JSON.
--agentsCreate custom subagentsmodified, high confidenceThe `--agents` flag accepts JSON with a `prompt` field plus these [frontmatter](#supported-frontmatter-fields) fields: `description`, `tools`, `disallowedTools`, `model`, `permissionMode`, `mcpServers`, `hooks`, `maxTurns`, `skills`, `init…see the edit
Since it was published
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
Added sinceA small documentation edit on CLI reference touched a line naming --agents after this was published.| `--agents` | Define custom subagents dynamically via JSON. Accepts the [fields listed for CLI-defined subagents](/docs/en/sub-agents#choose-the-subagent-scope). With `--print`, the value can instead be the path to a JSON file holding the…cli-referencesee the edit
Confirmed sinceAnthropic's documentation has since written up --agents, on Deploy managed settings.| [`disableSideloadFlags`](/docs/en/settings-reference#disablesideloadflags) | Reject the `--plugin-dir`, `--plugin-url`, `--agents`, and `--mcp-config` flags at startup. In cloud sessions, Claude Code drops the MCP servers the server deli…managed-settingssee the edit
How sure we are
Two sources agreeTwo things we can check say the same as this entry.
Anthropic's documentation agrees--agents on Create custom subagents
Anthropic's release notes agreeImproved --agents to accept the path to a JSON file (with -p) as well as inline JSON, and to allow an empty prompt