Skip to main content

Delivery

Delivery configuration controls how AgentGate ships completed work. This includes Git operations, pull request creation, and notifications to stakeholders.

What Is Delivery

After an agent successfully completes a task (all gates pass), the delivery phase:
  1. Commits changes to Git with structured messages
  2. Creates branches following naming conventions
  3. Opens pull requests with metadata and reviewers
  4. Sends notifications via Slack, email, or webhooks

Delivery Specification

spec:
  delivery:
    git:
      mode: github-pr
      branchPrefix: "fix/"
      commitPrefix: "[AgentGate]"
      autoCommit: true
      autoPush: true

    pr:
      create: true
      draft: false
      title: "fix: {task}"
      labels:
        - agent-generated
        - needs-review
      reviewers:
        - senior-dev

    notifications:
      onSuccess:
        - type: slack
          webhook: "https://hooks.slack.com/..."
          channel: "#deployments"

Git Modes

AgentGate supports three Git operation modes:
Commit locally onlyChanges are committed but not pushed. Use for local development or when you want manual control over pushing.
delivery:
  git:
    mode: local
    autoCommit: true
Workflow:
  1. Agent completes work
  2. Changes committed to local branch
  3. No remote operations
Best for:
  • Local development
  • Manual review before push
  • Testing and debugging

Git Configuration

Git Spec Options

git:
  mode: github-pr            # local | push | github-pr
  branchPrefix: "fix/"       # Prefix for branch names
  branchName: "custom-name"  # Override full branch name
  commitPrefix: "[Bot]"      # Prefix for commit messages
  commitTemplate: |          # Custom commit template
    {type}: {task}

    Changes:
    {changes}

    Generated by AgentGate
  autoCommit: true           # Auto-commit changes
  autoPush: true             # Auto-push to remote
  signCommits: false         # GPG sign commits

Configuration Options

OptionTypeDefaultDescription
modestringlocalGit operation mode
branchPrefixstringagentgate/Prefix for new branch names
branchNamestring-Override entire branch name
commitPrefixstring[AgentGate]Prefix for commit messages
commitTemplatestring-Custom commit message template
autoCommitbooleantrueAutomatically commit changes
autoPushbooleanfalseAutomatically push to remote
signCommitsbooleanfalseSign commits with GPG

Branch Naming

Branches are named using the pattern: {branchPrefix}{task-slug}
# With branchPrefix: "fix/"
# Task: "Fix null pointer in auth"
# Branch: fix/fix-null-pointer-in-auth

# Override with branchName
branchName: "hotfix/auth-npe-fix"
# Branch: hotfix/auth-npe-fix

Commit Messages

Commit messages can be customized using templates:
commitTemplate: |
  {type}: {task}

  {changes}

  Work Order: {workOrderId}
  Run: {runId}
  Generated by AgentGate
Available Variables:
VariableDescription
{type}Commit type (fix, feat, etc.)
{task}Task description
{changes}List of changed files
{workOrderId}Work order ID
{runId}Run ID
{date}Current date

Pull Request Configuration

Configure pull request creation for the github-pr mode:
pr:
  create: true
  draft: false
  title: "feat(auth): {task}"
  body: |
    ## Summary
    {task}

    ## Changes
    {changes}

    ## Testing
    - [ ] Unit tests pass
    - [ ] Integration tests pass

    ---
    Generated by AgentGate
  labels:
    - feature
    - agent-generated
    - needs-review
  reviewers:
    - lead-dev
    - security-team
  assignees:
    - platform-team
  base: main
  autoMerge:
    enabled: false
    method: squash
    waitForChecks: true
    deleteOnMerge: true

PR Spec Options

OptionTypeDefaultDescription
createbooleantrueWhether to create a PR
draftbooleanfalseCreate as draft PR
titlestring-PR title (supports templates)
bodystring-PR body (supports templates)
labelsstring[]-Labels to add to PR
reviewersstring[]-GitHub usernames for review
assigneesstring[]-GitHub usernames to assign
basestringdefault branchBase branch for PR
autoMergeobject-Auto-merge configuration

Auto-Merge Configuration

Enable automatic merging after checks pass:
autoMerge:
  enabled: true
  method: squash       # merge | squash | rebase
  waitForChecks: true  # Wait for CI checks
  deleteOnMerge: true  # Delete branch after merge
Auto-merge requires the repository to have branch protection rules enabled and the allow auto-merge setting turned on.

Notifications

Send notifications when tasks complete or fail:
notifications:
  onSuccess:
    - type: slack
      webhook: "https://hooks.slack.com/services/..."
      channel: "#deployments"
      template: "Task completed: {task}"

    - type: email
      to:
        - [email protected]
      subject: "AgentGate: {task} completed"

  onFailure:
    - type: slack
      webhook: "https://hooks.slack.com/services/..."
      channel: "#alerts"
      template: "Task failed: {task}. Error: {error}"

    - type: webhook
      url: "https://api.pagerduty.com/incidents"
      method: POST
      headers:
        Authorization: "Token token=${PAGERDUTY_TOKEN}"

Notification Types

Send to Slack channel
notifications:
  onSuccess:
    - type: slack
      webhook: "https://hooks.slack.com/services/T00/B00/XXX"
      channel: "#deployments"
      template: |
        :white_check_mark: *Task Completed*
        Task: {task}
        PR: {prUrl}
        Duration: {duration}
Options:
OptionTypeDescription
webhookstringSlack webhook URL
channelstringChannel override
templatestringMessage template

Template Variables

Available in notification templates:
VariableDescription
{task}Task description
{workOrderId}Work order ID
{runId}Run ID
{prUrl}Pull request URL
{prNumber}Pull request number
{branch}Branch name
{commit}Commit SHA
{duration}Execution duration
{error}Error message (failures only)
{iterations}Number of iterations

Complete Examples

Minimal Delivery

delivery:
  git:
    mode: local

Standard PR Workflow

delivery:
  git:
    mode: github-pr
    branchPrefix: "feat/"
    commitPrefix: "[Feature]"
    autoCommit: true
    autoPush: true

  pr:
    create: true
    draft: false
    title: "feat: {task}"
    labels:
      - enhancement
      - agent-generated
    reviewers:
      - team-lead
delivery:
  git:
    mode: github-pr
    branchPrefix: "fix/"
    commitPrefix: "[Hotfix]"
    commitTemplate: |
      fix: {task}

      This change addresses a critical bug in the system.

      Changes:
      {changes}

      Work Order: {workOrderId}
      Generated by AgentGate
    autoCommit: true
    autoPush: true
    signCommits: false

  pr:
    create: true
    draft: false
    title: "fix: {task}"
    body: |
      ## Summary
      Automated fix for: {task}

      ## Changes Made
      {changes}

      ## Verification
      - All gates passed
      - {iterations} iteration(s) to complete

      ## Testing
      - [ ] Review automated changes
      - [ ] Run manual smoke tests
      - [ ] Verify in staging

      ---
      Generated by AgentGate | Work Order: {workOrderId}
    labels:
      - bug
      - hotfix
      - agent-generated
      - needs-review
    reviewers:
      - senior-dev
      - security-team
    assignees:
      - on-call-team
    base: main
    autoMerge:
      enabled: true
      method: squash
      waitForChecks: true
      deleteOnMerge: true

  notifications:
    onSuccess:
      - type: slack
        webhook: "https://hooks.slack.com/services/T00/B00/XXX"
        channel: "#deployments"
        template: |
          :white_check_mark: *Hotfix Deployed*
          Task: {task}
          PR: {prUrl}
          Branch: `{branch}`
          Duration: {duration}

      - type: email
        to:
          - [email protected]
        subject: "Hotfix Completed: {task}"
        template: |
          A hotfix has been automatically applied and is pending review.

          Task: {task}
          Pull Request: {prUrl}
          Work Order: {workOrderId}

          Please review at your earliest convenience.

    onFailure:
      - type: slack
        webhook: "https://hooks.slack.com/services/T00/B00/XXX"
        channel: "#alerts"
        template: |
          :x: *Hotfix Failed*
          Task: {task}
          Error: {error}
          Work Order: {workOrderId}

      - type: webhook
        url: "https://api.pagerduty.com/incidents"
        method: POST
        headers:
          Authorization: "Token token=${PAGERDUTY_TOKEN}"

Delivery Results

After delivery, AgentGate returns structured results:
interface DeliveryResult {
  success: boolean;
  mode: 'local' | 'push' | 'github-pr';
  commit?: {
    success: boolean;
    sha?: string;
    filesCommitted: string[];
    error?: string;
  };
  push?: {
    success: boolean;
    remote?: string;
    branch?: string;
    error?: string;
  };
  pr?: {
    success: boolean;
    prNumber?: number;
    url?: string;
    error?: string;
  };
  notifications?: {
    type: string;
    success: boolean;
    error?: string;
  }[];
  error?: string;
}

Best Practices

1

Use Descriptive Branch Names

Use branch prefixes that indicate the type of change:
  • fix/ for bug fixes
  • feat/ for features
  • refactor/ for refactoring
  • docs/ for documentation
2

Add Meaningful Labels

Labels help with organization and filtering:
labels:
  - agent-generated  # Always identify agent work
  - needs-review     # Require human review
  - priority/high    # Categorize urgency
3

Assign Appropriate Reviewers

Match reviewers to the type of change:
reviewers:
  - security-team    # For auth changes
  - database-team    # For schema changes
  - frontend-team    # For UI changes
4

Configure Failure Notifications

Always set up failure notifications for visibility:
notifications:
  onFailure:
    - type: slack
      channel: "#alerts"
5

Use Auto-Merge Carefully

Only enable auto-merge for well-tested, low-risk changes:
autoMerge:
  enabled: true
  waitForChecks: true  # Always wait for CI

Troubleshooting

Ensure GitHub token has push permissions:
# Check token scopes
gh auth status

# Verify push access
git push --dry-run
Check repository permissions:
  • Token needs repo scope for private repos
  • Token needs public_repo for public repos
# Test PR creation
gh pr create --title "Test" --body "Test" --dry-run
Verify webhook URL is correct:
curl -X POST -H 'Content-type: application/json' \
  --data '{"text":"Test message"}' \
  "https://hooks.slack.com/services/T00/B00/XXX"
Check repository settings:
  1. Branch protection rules must be enabled
  2. “Allow auto-merge” must be checked in repo settings
  3. All required checks must be passing