Skip to content

test: agentic evaluation of the IAM actions with Claude Code - #141

Draft
joe4dev wants to merge 1 commit into
devx-1089-iam-actionsfrom
devx-1089-agentic-eval
Draft

joe4dev wants to merge 1 commit into
devx-1089-iam-actionsfrom
devx-1089-agentic-eval

Conversation

@joe4dev

@joe4dev joe4dev commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Motivation

DEVX-1089 asks for the IAM actions to be verified with a live agent fixing real failures. This adds an end-to-end evaluation: Claude Code, headless, fixes small CloudFormation projects that fail on IAM. Grading uses the deployed state after a clean redeploy, not the transcript and not an LLM judge.

Stacked on the IAM actions PR (#140).

Solution

  • evals/agentic/run.mjs: starts an isolated LocalStack on a random port, deploys the scenario, and runs the agent. It then redeploys from scratch and runs deterministic checks.
  • Two arms: a normal run with the server, and --without-mcp as the baseline. Both get the AWS CLI and LocalStack's log, so the baseline is fair.
  • Providers: the local Claude subscription by default; OpenRouter when OPENROUTER_API_KEY and OPENROUTER_MODEL are set.
  • Scenarios:
    • 06–08 put the deciding policy in another account (event bus source, KMS encryption context, bucket prefix by principal tag). They show what the server adds.
    • 01–05 are no-harm checks where the agent can read every policy: two guardrails it must not weaken, a missing permission, a Lambda resource policy, and a failure that isn't IAM.
  • agentic-eval.yml:
    • Runs on demand (every scenario unless one is given) and weekly, Monday 05:00, covering 02, 05 and 06–08, through OpenRouter.
    • Needs the secrets LOCALSTACK_AUTH_TOKEN and OPENROUTER_API_KEY, and the repository variable EVAL_OPENROUTER_MODEL (e.g. anthropic/claude-sonnet-5.5). The job fails early if any is missing.
  • Secrets (REVIEW §0):
    • The LocalStack token reaches only the container and the MCP server, through a private MCP config deleted after the run.
    • Scripts and git run without secrets.
    • Results are redacted, then checked for secrets before upload.
    • Claude Code and the AWS CLI are pinned where Dependabot updates them.
  • yarn test:evals (runner unit tests, in CI) and yarn eval:agentic.

Before this leaves draft

  • Blocker: the agent may run aws on the host, which can read host files (e.g. /proc/self/environ holding the OpenRouter key in CI). Run aws in a container that mounts only the project.
  • Record a maintainer's approval for the weekly paid run.
  • Set EVAL_OPENROUTER_MODEL.

Results

Run on 2026-11-23, 3 runs per scenario per arm, Sonnet 5.5:

Without server With server
Claude subscription 15/24 (06–08: 0/9) 24/24
OpenRouter 15/24 (06–08: 0/9) 24/24

The per-scenario table is in #140. A run takes 1–2.5 minutes and costs $0.04–0.135. A weekly run of 5 scenarios costs about $0.50.

Testing

  • yarn test:evals: 33/33.
  • Full runs as above, on the subscription and on OpenRouter.

🤖 Generated with Claude Code

evals/agentic runs Claude Code headless against an isolated LocalStack on a random port, on small CloudFormation
projects that fail on IAM, and grades the deployed state after a clean redeploy (no LLM judge). Every arm gets
the AWS CLI and LocalStack's log; --without-mcp drops the server for a fair baseline.

- 06-08: the deciding policy is in another account the agent can't read (event bus source, KMS encryption
  context, bucket prefix by principal tag). They show what the server adds.
- 01-05: no-harm checks where the agent can read every policy: a missing permission, an explicit deny and a
  permissions boundary (guardrails the agent must not weaken), a Lambda resource policy, and a failure that
  isn't IAM.
- Whether the agent called localstack-app-inspector or localstack-iam-policy-analyzer is reported, not graded.
- agentic-eval.yml runs on demand (every scenario unless one is given) and weekly (02, 05, 06-08) through
  OpenRouter. Secrets stay out of the agent's scripts and the uploaded results; Claude Code and the AWS CLI are
  pinned where Dependabot updates them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant