---
title: "Run agents in CI only for trusted people · Agent Wranglers"
url: https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions/ci-agents-trusted-triggers
updated: 2026-10-20
licence: "All rights reserved"
---

# Run agents in CI only for trusted people

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [Safety and permissions](https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions)
- Rule: An agent in CI starts only for people with write access to the repository. Its job holds no secrets it does not need.
- How: Anyone can write an issue or a fork pull request, and the agent reads it as instructions. Check the author's permission before the agent starts. Give the job a read-only token and let it propose changes only as a pull request for review. Never run it on `pull_request_target` with code from a fork. See [keep build secrets from forks](https://agentwranglers.se/playbook/adversarial-testing/supply-chain-and-setup/ci-secrets).
- Check: From a test account without write access, open an issue that mentions the agent. The job does not start, and the log names the refusal.

Example:

```yaml
on:
  issue_comment:
    types: [created]
permissions:
  contents: read
  pull-requests: write
jobs:
  agent:
    if: contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@<full-commit-hash>
      - run: ./run-agent.sh   # opens a pull request, never pushes to main
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers ai development playbook: https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions/ci-agents-trusted-triggers`.

- Previous: [Treat what the agent reads as untrusted](https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions/untrusted-context)
- Next: [Review agent settings like code](https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions/review-agent-config)
- [Safety and permissions](https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions)
