Skip to main content
This recipe builds an agent that runs when someone opens a pull request, reads the changed files, and posts one review comment on the pull request. It uses a Native agent: you write a prompt and a tool list, no code.

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

Replace PROMPT.md with the agent’s instructions:
Replace guild.yaml with the tools the prompt uses:
Listing only the tools the agent needs keeps it focused. See 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, run guild trigger sessions <trigger-id> and open the session URL. Find the trigger ID with guild trigger list.

Variations

  • Skip draft pull requests. opened also 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_review so 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_comment with --action created, and add github_issues_create_comment to the tools. Comments on pull requests and issues both arrive as issue_comment events; a pull request’s issue.html_url contains /pull/. Guild doesn’t filter out the agent’s own comments, so tell the agent to stop when comment.user.type is Bot, or each reply triggers another run.
Last modified on October 15, 2026