agent --prompt "Fix the failing tests" --allow-all-toolsagent --prompt "Fix the failing tests" \
--allowed-tools "Read,Edit,Bash(npm test)" \
--max-turns 15 \
--output-format json > result.jsonListing allowed tools, capping turns and writing JSON makes the CI run safe, bounded and easy to parse.
Only with no secrets and read-only tools. Fork pull requests can contain injected instructions, so never give that job write tokens or deploy access.
Store it as a CI secret and expose it as an environment variable for that job only. Never commit it to the repository or print it in logs.
Common uses are fixing lint errors, updating docs, triaging issues and reviewing pull requests, with results posted as comments or commits.