|
| 1 | +name: Agentic eval |
| 2 | + |
| 3 | +# A coding agent (Claude Code headless, through OpenRouter) fixes common IAM failures with this MCP server, the AWS |
| 4 | +# CLI and LocalStack's log. |
| 5 | +# On demand (every scenario unless one is given) and weekly (02, 05 and 06-08): each run costs model tokens and takes |
| 6 | +# a few minutes per scenario. |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + scenario: |
| 11 | + description: "Scenario prefix to run (e.g. 01); empty runs all" |
| 12 | + required: false |
| 13 | + default: "" |
| 14 | + repeat: |
| 15 | + description: "Runs per scenario" |
| 16 | + required: false |
| 17 | + default: "1" |
| 18 | + model: |
| 19 | + description: "OpenRouter model slug (defaults to the repository variable EVAL_OPENROUTER_MODEL)" |
| 20 | + required: false |
| 21 | + default: "" |
| 22 | + schedule: |
| 23 | + - cron: "0 5 * * 1" |
| 24 | + |
| 25 | +permissions: |
| 26 | + contents: read |
| 27 | + |
| 28 | +jobs: |
| 29 | + agentic-eval: |
| 30 | + runs-on: ubuntu-26.04 |
| 31 | + timeout-minutes: 120 |
| 32 | + steps: |
| 33 | + # Fail loudly instead of looking tested: a scheduled run on a fork, or a missing secret or model. |
| 34 | + - name: Require the secrets and the model |
| 35 | + env: |
| 36 | + HAS_LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN != '' }} |
| 37 | + HAS_OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY != '' }} |
| 38 | + OPENROUTER_MODEL: ${{ inputs.model || vars.EVAL_OPENROUTER_MODEL }} |
| 39 | + run: | |
| 40 | + missing=() |
| 41 | + [ "$HAS_LOCALSTACK_AUTH_TOKEN" = "true" ] || missing+=("secret LOCALSTACK_AUTH_TOKEN") |
| 42 | + [ "$HAS_OPENROUTER_API_KEY" = "true" ] || missing+=("secret OPENROUTER_API_KEY") |
| 43 | + [ -n "$OPENROUTER_MODEL" ] || missing+=("the model input or repository variable EVAL_OPENROUTER_MODEL") |
| 44 | + if [ ${#missing[@]} -gt 0 ]; then |
| 45 | + echo "::error::Missing: ${missing[*]}" |
| 46 | + exit 1 |
| 47 | + fi |
| 48 | +
|
| 49 | + - name: Checkout code |
| 50 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 51 | + with: |
| 52 | + # later steps run third-party code and the agent: no GitHub token in .git/config |
| 53 | + persist-credentials: false |
| 54 | + |
| 55 | + - name: Use Node.js 22 |
| 56 | + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 |
| 57 | + with: |
| 58 | + node-version: 22.x |
| 59 | + |
| 60 | + - name: Install dependencies |
| 61 | + run: yarn install --frozen-lockfile |
| 62 | + |
| 63 | + # The agent under test, at the version in evals/agentic/tools/package-lock.json (Dependabot). |
| 64 | + - name: Install Claude Code |
| 65 | + run: | |
| 66 | + npm ci --prefix evals/agentic/tools --omit=dev --no-audit --no-fund |
| 67 | + echo "$GITHUB_WORKSPACE/evals/agentic/tools/node_modules/.bin" >> "$GITHUB_PATH" |
| 68 | +
|
| 69 | + # The nightly image, the runner's default: the scenarios need the IAM event details on LocalStack's main branch, |
| 70 | + # which a release has only later. |
| 71 | + - name: Pull the LocalStack image |
| 72 | + run: docker pull localstack/localstack-pro:dev |
| 73 | + |
| 74 | + # The AWS CLI the scenarios' deploy and trigger scripts run, at the version pinned in |
| 75 | + # evals/agentic/tools/Dockerfile, ahead of the runner image's own on the PATH. |
| 76 | + # TODO: use the host-tools action's AWS CLI once https://github.com/localstack/localstack-mcp-server/pull/137 lands. |
| 77 | + - name: Install the AWS CLI |
| 78 | + run: | |
| 79 | + docker build --output "type=local,dest=$RUNNER_TEMP/awscli" evals/agentic/tools |
| 80 | + echo "$RUNNER_TEMP/awscli/aws-cli/bin" >> "$GITHUB_PATH" |
| 81 | + "$RUNNER_TEMP/awscli/aws-cli/bin/aws" --version |
| 82 | +
|
| 83 | + # Without secrets: the build runs code from node_modules. |
| 84 | + - name: Build the MCP server |
| 85 | + run: yarn build |
| 86 | + |
| 87 | + # Secrets only for this step. The LocalStack token reaches only the container and the MCP server; the OpenRouter |
| 88 | + # key is Claude Code's credential, so the processes Claude Code starts inherit it (evals/agentic/README.md). |
| 89 | + - name: Run the agentic evaluation |
| 90 | + env: |
| 91 | + LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} |
| 92 | + OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} |
| 93 | + OPENROUTER_MODEL: ${{ inputs.model || vars.EVAL_OPENROUTER_MODEL }} |
| 94 | + MCP_ANALYTICS_DISABLED: "1" |
| 95 | + # Weekly: the no-harm checks that matter most (02 guardrail, 05 not IAM) and the cross-account scenarios. |
| 96 | + SCENARIO: ${{ github.event_name == 'schedule' && '02,05,06,07,08' || inputs.scenario }} |
| 97 | + REPEAT: ${{ inputs.repeat || '1' }} |
| 98 | + run: | |
| 99 | + args=(--repeat "$REPEAT") |
| 100 | + if [ -n "$SCENARIO" ]; then args+=(--scenario "$SCENARIO"); fi |
| 101 | + node evals/agentic/run.mjs "${args[@]}" |
| 102 | +
|
| 103 | + # The runner redacts secrets before it writes a result; this checks it did, since GitHub does not mask artifacts. |
| 104 | + - name: Check the results hold no secret |
| 105 | + id: secret-check |
| 106 | + if: always() |
| 107 | + env: |
| 108 | + LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} |
| 109 | + OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} |
| 110 | + run: | |
| 111 | + [ -d evals/agentic/results ] || exit 0 |
| 112 | + for value in "$LOCALSTACK_AUTH_TOKEN" "$OPENROUTER_API_KEY"; do |
| 113 | + if [ -n "$value" ] && grep -rqF -- "$value" evals/agentic/results; then |
| 114 | + echo "::error::A secret is in the results. They are not uploaded; rotate the secret." |
| 115 | + exit 1 |
| 116 | + fi |
| 117 | + done |
| 118 | +
|
| 119 | + - name: Keep the results |
| 120 | + if: always() && steps.secret-check.outcome == 'success' |
| 121 | + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 |
| 122 | + with: |
| 123 | + name: agentic-eval-results |
| 124 | + path: evals/agentic/results |
| 125 | + retention-days: 14 |
| 126 | + if-no-files-found: ignore |
0 commit comments