Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ updates:
# when it no longer applies. Bump it by hand and redo or drop the patch.
- dependency-name: "@gleanwork/mcp-server-tester"

# CLIs inside the Docker image (aws-cdk, lstk) and the CDK sample app that CI deploys with them.
# CLIs inside the Docker image (aws-cdk, lstk), the CDK sample app that CI deploys with them, and the
# coding agent the agentic eval runs (Claude Code).
- package-ecosystem: npm
directories:
- /docker/tools/npm
- /data/sample-cdk
- /evals/agentic/tools
schedule:
interval: weekly
cooldown:
Expand Down Expand Up @@ -61,7 +63,11 @@ updates:

# FROM lines in the Dockerfile: node and hashicorp/terraform.
- package-ecosystem: docker
directory: /
directories:
- /
# TODO: remove with evals/agentic/tools/Dockerfile once
# https://github.com/localstack/localstack-mcp-server/pull/137 lands
- /evals/agentic/tools
schedule:
interval: weekly
cooldown:
Expand Down
126 changes: 126 additions & 0 deletions .github/workflows/agentic-eval.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Agentic eval

# A coding agent (Claude Code headless, through OpenRouter) fixes common IAM failures with this MCP server, the AWS
# CLI and LocalStack's log.
# On demand (every scenario unless one is given) and weekly (02, 05 and 06-08): each run costs model tokens and takes
# a few minutes per scenario.
on:
workflow_dispatch:
inputs:
scenario:
description: "Scenario prefix to run (e.g. 01); empty runs all"
required: false
default: ""
repeat:
description: "Runs per scenario"
required: false
default: "1"
model:
description: "OpenRouter model slug (defaults to the repository variable EVAL_OPENROUTER_MODEL)"
required: false
default: ""
schedule:
- cron: "0 5 * * 1"

permissions:
contents: read

jobs:
agentic-eval:
runs-on: ubuntu-26.04
timeout-minutes: 120
steps:
# Fail loudly instead of looking tested: a scheduled run on a fork, or a missing secret or model.
- name: Require the secrets and the model
env:
HAS_LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN != '' }}
HAS_OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY != '' }}
OPENROUTER_MODEL: ${{ inputs.model || vars.EVAL_OPENROUTER_MODEL }}
run: |
missing=()
[ "$HAS_LOCALSTACK_AUTH_TOKEN" = "true" ] || missing+=("secret LOCALSTACK_AUTH_TOKEN")
[ "$HAS_OPENROUTER_API_KEY" = "true" ] || missing+=("secret OPENROUTER_API_KEY")
[ -n "$OPENROUTER_MODEL" ] || missing+=("the model input or repository variable EVAL_OPENROUTER_MODEL")
if [ ${#missing[@]} -gt 0 ]; then
echo "::error::Missing: ${missing[*]}"
exit 1
fi

- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# later steps run third-party code and the agent: no GitHub token in .git/config
persist-credentials: false

- name: Use Node.js 22
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22.x

- name: Install dependencies
run: yarn install --frozen-lockfile

# The agent under test, at the version in evals/agentic/tools/package-lock.json (Dependabot).
- name: Install Claude Code
run: |
npm ci --prefix evals/agentic/tools --omit=dev --no-audit --no-fund
echo "$GITHUB_WORKSPACE/evals/agentic/tools/node_modules/.bin" >> "$GITHUB_PATH"

# The nightly image, the runner's default: the scenarios need the IAM event details on LocalStack's main branch,
# which a release has only later.
- name: Pull the LocalStack image
run: docker pull localstack/localstack-pro:dev

# The AWS CLI the scenarios' deploy and trigger scripts run, at the version pinned in
# evals/agentic/tools/Dockerfile, ahead of the runner image's own on the PATH.
# TODO: use the host-tools action's AWS CLI once https://github.com/localstack/localstack-mcp-server/pull/137 lands.
- name: Install the AWS CLI
run: |
docker build --output "type=local,dest=$RUNNER_TEMP/awscli" evals/agentic/tools
echo "$RUNNER_TEMP/awscli/aws-cli/bin" >> "$GITHUB_PATH"
"$RUNNER_TEMP/awscli/aws-cli/bin/aws" --version

# Without secrets: the build runs code from node_modules.
- name: Build the MCP server
run: yarn build

# Secrets only for this step. The LocalStack token reaches only the container and the MCP server; the OpenRouter
# key is Claude Code's credential, so the processes Claude Code starts inherit it (evals/agentic/README.md).
- name: Run the agentic evaluation
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
OPENROUTER_MODEL: ${{ inputs.model || vars.EVAL_OPENROUTER_MODEL }}
MCP_ANALYTICS_DISABLED: "1"
# Weekly: the no-harm checks that matter most (02 guardrail, 05 not IAM) and the cross-account scenarios.
SCENARIO: ${{ github.event_name == 'schedule' && '02,05,06,07,08' || inputs.scenario }}
REPEAT: ${{ inputs.repeat || '1' }}
run: |
args=(--repeat "$REPEAT")
if [ -n "$SCENARIO" ]; then args+=(--scenario "$SCENARIO"); fi
node evals/agentic/run.mjs "${args[@]}"

# The runner redacts secrets before it writes a result; this checks it did, since GitHub does not mask artifacts.
- name: Check the results hold no secret
id: secret-check
if: always()
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
run: |
[ -d evals/agentic/results ] || exit 0
for value in "$LOCALSTACK_AUTH_TOKEN" "$OPENROUTER_API_KEY"; do
if [ -n "$value" ] && grep -rqF -- "$value" evals/agentic/results; then
echo "::error::A secret is in the results. They are not uploaded; rotate the secret."
exit 1
fi
done

- name: Keep the results
if: always() && steps.secret-check.outcome == 'success'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: agentic-eval-results
path: evals/agentic/results
retention-days: 14
if-no-files-found: ignore
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
- name: Unit tests
run: yarn test

- name: Unit tests of the agentic eval runner
run: yarn test:evals

- name: Build the project
run: yarn build

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ terraform.tfstate*
.terraform/
.terraform.lock.hcl
.mcp-test-results/
evals/agentic/results/
.DS_Store
cdk.out/
18 changes: 11 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ yarn test # Jest unit tests: *.test.ts next to the code, handler t
yarn test:mcp:direct # Playwright: calls the built server's tools directly, plus the Azure offline suite (needs Docker + LOCALSTACK_AUTH_TOKEN)
yarn test:mcp:tools # Playwright: each tool against a real LocalStack, no model (needs Docker + LOCALSTACK_AUTH_TOKEN)
yarn test:mcp:evals # Playwright: LLM evals through OpenRouter (needs OPENROUTER_API_KEY, LOCALSTACK_AUTH_TOKEN, and terraform, lstk and snow on PATH; EVAL_MODEL swaps the model)
yarn test:evals # node --test: unit tests of the agentic eval runner (evals/agentic/lib)
yarn eval:agentic # Claude Code fixes IAM failures with this server and the AWS CLI (needs Docker, the AWS CLI, Claude Code, LOCALSTACK_AUTH_TOKEN; see evals/agentic/README.md)
yarn format # Prettier
```

Expand All @@ -38,6 +40,7 @@ yarn format # Prettier
| `src/tools-tests/` | Handler tests, one file per tool. They live outside `src/tools/` because xmcp registers every file there as a tool. |
| `tests/mcp/` | Playwright tests against the built server. |
| `tests/docker/` | Validation of the Docker image. |
| `evals/agentic/` | The agentic evaluation of the IAM actions: scenarios, runner, and the pinned tools it runs. |
| `docs/` | Topic docs. |

## Writing a tool
Expand Down Expand Up @@ -67,6 +70,8 @@ the failing test first when fixing a bug in `src/`.
| Tools | `tests/mcp/tools.spec.mjs` | every PR, with the auth token | Each tool over MCP stdio against a real emulator, without a model. |
| Server | `tests/mcp/direct.spec.mjs` | every PR, with the auth token | The built server: tool list, prompts, setup wizard. |
| Image | `tests/docker/validate-image.mjs` | `docker.yml`, with the auth token | Real calls through the Docker image. |
| Evals | `data/evals/comprehensive.json` (`tests/mcp/evals.spec.mjs`) | after merges to `main`, weekly, on demand | Whether a model picks the right tool and action for a request. |
| Agentic | `evals/agentic/` (`agentic-eval.yml`) | weekly, on demand | Whether a coding agent fixes a whole project with the tools, graded by its final state. |

Rules for tool tests:

Expand Down Expand Up @@ -320,7 +325,12 @@ denials, since it can break a workload that worked: point to `SOFT_MODE`.
Render every payload string escaped (REVIEW §7): an ARN, a resource name or an error message must not be able to
close a code fence, break a table, or leave its fence or cell.

An agentic evaluation of these actions is a follow-up (see [Follow-ups](#follow-ups)).
`evals/agentic/` checks the actions end to end: Claude Code, given this server's IAM tools, the AWS CLI and
LocalStack's log, fixes small CloudFormation projects and is graded by the deployed state after a clean redeploy (see its README). Under REVIEW
§0 it keeps the auth token in a private MCP config deleted after the run, runs its own scripts and git without
secrets and outside the agent's reach, redacts the results and checks them before upload, and pins the tools it
runs where Dependabot updates them. The model key is Claude Code's credential, so the processes Claude Code
starts inherit it.

## Gaps in LocalStack

Expand Down Expand Up @@ -408,12 +418,6 @@ Decisions not settled yet. Ask the user before acting on one, and move the answe

Planned work that is not on `main` yet. Ask the user before starting one.

- **Agentic evaluation of the IAM actions.** A coding agent (Claude Code headless) fixes common IAM failures in small
projects using only this server, graded by deterministic checks, on demand and weekly. Before it lands it must
meet REVIEW §0 and "Dependencies": the agent and the scripts it runs get no secrets, the MCP config holding the
auth token is private and deleted after the run, the agent can read and edit only its project and cannot change
the scripts it may run, results are redacted and checked before upload, workflow inputs go through `env:`, and
Claude Code is pinned in a lockfile Dependabot updates.
- **`lstk mcp`'s `failed-requests` action (lstk, unreleased).** It groups App Inspector's failed spans
(`status_code=2`) by service, operation, HTTP status and AWS error code, with counts, first and last time and the
latest example. That computation is an approved exception to rule 5: approved by the
Expand Down
Loading