Before you start
- The Guild CLI, logged in.
- GitHub connected in your workspace, with the Guild GitHub App installed on the repository. See GitHub setup.
1. Create the agent
PROMPT.md with the agent’s instructions:
guild.yaml with the tools the prompt uses:
guild.yaml for the rules.
2. Save it and install it in your workspace
3. Create the trigger
service_config.repo limits the trigger to one repository. It must match the repository’s full name exactly, as owner/repo. Without it, the trigger fires for every repository the GitHub App can see.
The agent receives a prompt that names the event and action, followed by the pull request payload as JSON. Guild trims the payload to the fields an agent needs, such as the number, title, body, author, and head and base branches. Each event starts a new session.
4. Try it
Open a pull request in the repository. The agent’s review appears on it, posted by the Guild GitHub App. To see what the agent did, runguild trigger sessions <trigger-id> and open the session URL. Find the trigger ID with guild trigger list.
Variations
- Skip draft pull requests.
openedalso fires for drafts. Add “If pull_request.draft is true, stop without posting” to the prompt, and create a second trigger with--action ready_for_reviewso drafts are reviewed when they’re marked ready. - Review every push. Add a trigger with
--action synchronize. Tell the agent to keep the review short, since it will post once per push. - Answer questions in comments. Trigger on
issue_commentwith--action created, and addgithub_issues_create_commentto the tools. Comments on pull requests and issues both arrive asissue_commentevents; a pull request’sissue.html_urlcontains/pull/. Guild doesn’t filter out the agent’s own comments, so tell the agent to stop whencomment.user.typeisBot, or each reply triggers another run.
Related
- GitHub integration: every tool and webhook event
- Event triggers: agent input, placeholders, and
service_config - Identity mapping: which Guild user a GitHub-triggered run acts as