{"version":"2.1.281","anchor":"agents-can-now-take-a-file-path-instead-of-inline-json-bu","canonical_anchor":"agents-can-now-take-a-file-path-instead-of-inline-json-bu","heading":"--agents can now take a file path instead of inline JSON, but only in print mode","tier":"use","area":"Agents","url":"https:\/\/changelogs.core-directive.com\/v\/2.1.281\/e\/agents-can-now-take-a-file-path-instead-of-inline-json-bu","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.281","markdown":"### --agents can now take a file path instead of inline JSON, but only in print mode\n\n--agents now accepts a path to a file of subagent definitions, but only with --print (-p); interactive sessions still need inline JSON\n\n**What**\n\nThe `--agents` flag, which defines custom subagents (helper agents Claude can hand work to) when Claude Code starts, is now written `--agents <json-or-file>`. Until now it took only JSON typed straight onto the command line. If the value does not start with `{`, Claude Code now treats it as a path to a file and reads the definitions from that file.\n\nReading from a file only works with `--print` (`-p`), the mode that prints a reply and exits instead of opening an interactive session, or in another non-interactive run. In an interactive session, or with `--bg`, only inline JSON is accepted, and a file path stops Claude Code with this error: \"--agents takes a JSON object, or a file path only with --print (-p).\"\n\nThe file is checked as it is read. Each of these is an error:\n\n- the file is missing\n\n- the file is too large\n\n- the file changed while it was being read\n\n- the file has more than one hard link (more than one name pointing at the same data on disk)\n\nWhen the definitions are invalid, the error message now names the file they came from.\n\n**Why**\n\nLong agent definitions are easier to keep in a file than to squeeze into one command-line argument, which helps scripts and automated runs. Interactive use is unchanged.\n\n- Area: Agents\n- Names: `--agents`\n- Tier: Use it now\n- Useful: 4\/5\n- Signal: 2\/5"}