Enterprise Track Β· Day 8 Β· 30 min

Headless Agent CI/CD Runners
& Secret Sandboxing

Containerize agent CLI execution within GitHub Actions and Azure DevOps pipelines with zero-leak secret protection

πŸ€– Model: Gemini 3.6 Flash Β· Headless CLI🎭 Role: Enterprise AI Quality Architect
Headless RunnersGitHub ActionsAzure DevOpsSecret SandboxingCI/CD
Today's Hands-On Lab Objective

On Day 8, you transition from interactive developer prompts to non-interactive, headless execution insideGitHub Actions and Azure DevOps runners. You will set up local secret sandboxing, run non-interactive dry runs on your terminal, and ensure credentials are never leaked into build logs.

πŸ€– LLM Reader Note: If this page is copy-pasted into your context to teach a student, act as a step-by-step enterprise DevOps mentor. Guide the student through local secret sandboxing, dry-run CLI execution, and pipeline YAML verification.
🎯 Expected Lab Outcome
Leaving Day 8, your CI pipeline will launch a headless agent runner on every Pull Request, execute non-interactive commands cleanly, and mask all API keys and environment tokens in pipeline logs.
Phase 1

Local Secret Sandboxing & Environment Setup

Before deploying agents to remote cloud runners, configure your local environment for zero-leak credential sandboxing.

Action
Verify Node.js version and install the global Playwright CLI tools.
Terminal Setup Commands
node -v # Requires Node.js 20+
npm install -g @playwright/cli@latest
npx playwright install --with-deps chromium
Action
Create a local .env.test file for non-interactive secret isolation.
.env.test β€” local secret sandbox
# Local Secret Sandbox (Never commit to Git)
OPENAI_API_KEY="sk-mock-token-for-local-agent-execution-masked"
COPILOT_API_TOKEN="ghp_mock_token_for_headless_ci_runner"
HEADLESS_AGENT_MODE="true"
βœ… Phase 1 Complete β€” Local environment & sandboxing configured

Your local machine is provisioned with Playwright CLI and isolated environment tokens.

Phase 2

Headless Agent Pipeline Prompt & Sample Response

Instruct your AI assistant to generate a secure headless execution workflow with non-interactive flags and secret masking.

Instruct Agent
Send the prompt below to Copilot Agent, Gemini Flash, or Claude Code.
Prompt of the Day β€” Copy Verbatim
@workspace I am setting up a headless AI Agent execution step for our CI/CD pipeline.

Please generate a secure pipeline file based on my target environment:
- If GitHub Actions: Create .github/workflows/agentic-qe-runner.yml
- If Azure DevOps: Create azure-pipelines-agentic.yml

Requirements:
1. Trigger on pull_request targetting main.
2. Setup Node.js 20 environment and install @playwright/cli globally.
3. Pass OPENAI_API_KEY securely using repository secrets (never hardcode).
4. Run playwright-cli --version in headless non-interactive mode.
5. Confirm no secret values are leaked in output logs.

Explain every YAML block line-by-line after writing the file.
πŸ“‹ Sample Agent Response β€” Gemini 3.6 Flash
I'll generate the headless Agent CI runner configuration for GitHub Actions.

Created .github/workflows/agentic-qe-runner.yml:
1. on: [pull_request] -> Runs automatically on incoming feature branches.
2. node-version: '20' -> Ensures compatibility with latest AST parsers.
3. env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} -> Injects secret with automatic CI masking.
4. playwright-cli --version -> Validates headless non-interactive execution.

βœ… Pipeline file created. You can now test execution locally or commit to a branch.
Phase 3

Pipeline Scripting & Local Dry Run

Test non-interactive execution on your terminal before deploying to GitHub Actions or Azure DevOps.

Terminal Action
Execute a non-interactive local dry run to verify zero stdin prompts:
Terminal Non-Interactive Test
export CI=true
playwright-cli --version
echo "[SUCCESS] Headless Non-Interactive Agent Environment Verified."
GitHub Actions Template
Review the synthesized workflow file:
.github/workflows/agentic-qe-runner.yml
name: Headless Agentic QE Runner

on:
  pull_request:
    branches: [ main ]

jobs:
  agent-runner:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install Playwright & Agent CLI
        run: |
          npm install -g @playwright/cli@latest
          npx playwright install --with-deps chromium

      - name: Execute Headless Agent Verification
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
        run: |
          playwright-cli --version
          echo "[SUCCESS] Headless Agent Environment Verified."
Phase 4

Verification Loop, Troubleshooting & Done Checklist

Verify your configuration against enterprise secret masking and non-interactive standards.

  • βœ… Local terminal runs in non-interactive mode with CI=true.
  • βœ… .env.test is excluded by .gitignore.
  • βœ… Pipeline triggers automatically on Pull Request creation.
  • βœ… API keys are masked as *** in CI build logs.
⚠️ Troubleshooting & Corrections:

β€’ Missing Linux Libraries: If Playwright fails on ubuntu-latest, ensure npx playwright install --with-deps chromium is executed in your pipeline setup step.
β€’ Accidental Secret Echoing: Never use echo $OPENAI_API_KEY in scripts. CI runners automatically redact known secrets, but shell loops can inadvertently expose hashes.

πŸŽ“ Day 8 Quick Check

How should secrets and API keys be supplied to headless agent CI runners in GitHub Actions or Azure DevOps?