My Background Agent Stack Is Now a Fully Operational CI/CD System

I want to start off this post by providing a nugget of value.

You want to make sure to add this to your planning-agent.md in your initial step for running background agents. Make sure this is absolutely added if you want to trigger your CICD pipeline in the async environment using your custom implementation-agent.md.

],
  "post_implementation_deployment_instructions": {
    "critical_context": "You are operating in an asynchronous background agent environment. Traditional CLI deployment commands will NOT work. You MUST use API calls with environment tokens.",
    "environment_tokens_required": {
      "VERCEL_TOKEN": "Required for Vercel API deployments",
      "GITHUB_TOKEN": "Required for GitHub API operations"
    },
    "step_by_step_deployment_sequence": {
      "step_1_git_operations": {
        "commands": [
          "git add .",
          "git commit -m 'feat: [DESCRIPTIVE_COMMIT_MESSAGE] - production ready'",
          "git push origin cursor/[FEATURE_BRANCH_NAME]"
        ],
        "note": "Create feature branch name dynamically with timestamp/hash suffix"
      },
      "step_2_github_pr_creation": {
        "method": "GitHub REST API",
        "example_command": "curl -X POST -H 'Authorization: token $GITHUB_TOKEN' -H 'Accept: application/vnd.github.v3+json' https://api.github.com/repos/[GITHUB_USERNAME]/[REPO_NAME]/pulls -d '{\"title\": \"feat: [DESCRIPTIVE_PR_TITLE]\", \"head\": \"cursor/[FEATURE_BRANCH_NAME]\", \"base\": \"main\", \"body\": \"[COMPREHENSIVE_DESCRIPTION_WITH_IMPLEMENTATION_DETAILS]\"}'",
        "required_fields": {
          "title": "Descriptive PR title",
          "head": "Feature branch name", 
          "base": "main",
          "body": "Comprehensive description with implementation details"
        }
      },
      "step_3_vercel_deployment": {
        "method": "Vercel API",
        "example_command": "curl -X POST -H 'Authorization: Bearer $VERCEL_TOKEN' -H 'Content-Type: application/json' https://api.vercel.com/v13/deployments -d '{\"name\": \"[PROJECT_NAME]\", \"gitSource\": {\"type\": \"github\", \"repo\": \"[GITHUB_USERNAME]/[REPO_NAME]\", \"repoId\": [REPO_ID], \"ref\": \"cursor/[FEATURE_BRANCH_NAME]\"}, \"projectSettings\": {\"framework\": \"nextjs\"}, \"target\": \"staging\"}'",
        "required_fields": {
          "name": "[PROJECT_NAME]",
          "gitSource.repo": "[GITHUB_USERNAME]/[REPO_NAME]",
          "gitSource.repoId": "[NUMERIC_REPO_ID]",
          "gitSource.ref": "Feature branch name",
          "target": "staging"
        }
      }
    },
    "critical_warnings": {
      "do_not_use_cli_commands": "DO NOT attempt to use 'vercel deploy', 'gh pr create', or similar CLI commands - they will fail in this async environment",
      "must_use_api_tokens": "You MUST use the API endpoints with the environment tokens",
      "verify_tokens_first": "Always verify tokens exist with 'echo $VERCEL_TOKEN' and 'echo $GITHUB_TOKEN' before proceeding",
      "deployment_target": "Use 'staging' target for initial deployment, not production"
    },
    "success_criteria": {
      "git_push_successful": "Feature branch pushed to GitHub successfully",
      "pr_created": "Pull request created and accessible via GitHub API response",
      "vercel_deployment_initiated": "Vercel deployment started and deployment URL returned",
      "staging_url_accessible": "Staging deployment accessible and functioning"
    }
  }
}

This setup lets me go from a ⌘E planning command to a production-ready PR and deployment in a few minutes.

  • Planning agent defines the spec + architecture
  • Implementation agent builds full-stack code (UI, API, types, tests)
  • Debugging agent monitors + auto-fixes issues in real time
  • Final agent creates PR via GitHub API and deploys to Vercel via API (not CLI)

All CI/CD is async-safe and token-authenticated.
No CLI commands. No manual steps. Just fire the pipeline and ship.

Built + deployed 12.5k LOC across 3 full features in 4 hours for <$50.
System works. It’s live. This is real.

1 Like

This sounds great, thank you for sharing your experience.

Which model or models were you using for this process?

I’ve been relying on Gemini 2.5 pro and Claude 4 sonnet max.

Also, no prob. I plan on sharing much more :folded_hands:

2 Likes

Thanks for sharing! :slight_smile:
would this be working without a MAX model? or is it a ‘must’?

1 Like

@proteus-dev

This is so hard to answer :slight_smile:

I have very detailed projects with rules, architecture docu & prompts etc that work only with models that are adhering to the dot (3.5 Sonnet), any other models gets it totally wrong.

At same time I tried soft-‘vibe’ coding as a dev of over 30 years experience. Basically wrote core principles in my user rules and used Claude 4 Sonnet Thinking MAX and it nailed all the needed things for open tasks.

1 Like