# Agent pool supervisor (docs/plans/agent-pool-orchestrator.md). # # Stateless tick: reconciles pool claims and spawns Cursor Cloud workers up to # POOL_MAX_SLOTS over `ready` autonomous-eligible issues. Three triggers: # - workflow_dispatch — the canonical human channel (start/stop/pause/resume) # - schedule */10min — the periodic reconcile (default branch only) # - pull_request closed on main — immediate slot replenish after a merge # # Secrets: # CURSOR_API_KEY — Cursor Cloud Agents API key # POOL_GITHUB_TOKEN — PAT with actions:write + issues:write (required to read/ # write repo Actions variables; default GITHUB_TOKEN often 403s — mirror of # the old PROMOTE_GITHUB_TOKEN pattern) name: Agent pool supervisor on: schedule: - cron: '*/10 * * * *' pull_request: types: [closed] branches: [main] workflow_dispatch: inputs: action: description: 'Ação do pool' required: true type: choice options: - start - stop - pause - resume - tick - status maxSlots: description: 'Slots simultâneos (só com action=start; default 5, máx 8)' required: false type: string concurrency: group: agent-pool cancel-in-progress: false permissions: actions: write contents: read issues: write pull-requests: read jobs: tick: runs-on: ubuntu-latest timeout-minutes: 10 if: github.event_name != 'pull_request' || github.event.pull_request.merged == true steps: - uses: actions/checkout@v5 - uses: pnpm/action-setup@v6 - uses: actions/setup-node@v5 with: node-version: 24 cache: pnpm - run: pnpm install --frozen-lockfile - name: agent:pool workflow env: GH_TOKEN: ${{ secrets.POOL_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }} ACTION: ${{ inputs.action }} MAX_SLOTS: ${{ inputs.maxSlots }} run: | if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then args=(--action "$ACTION" --actor "$GITHUB_ACTOR") if [ -n "$MAX_SLOTS" ]; then args+=(--max-slots "$MAX_SLOTS"); fi else args=(--action tick --actor "$GITHUB_ACTOR") fi node scripts/agent-pool.mjs workflow "${args[@]}"