jason810496 commented on code in PR #69308: URL: https://github.com/apache/airflow/pull/69308#discussion_r3519395451
########## dev/skill-evals/eval.py: ########## @@ -0,0 +1,350 @@ +#!/usr/bin/env python3 +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# /// script +# requires-python = ">=3.9" +# /// +"""Airflow skill-eval harness. + +Test whether AGENTS.md guidance affects agent decisions by comparing +arms with and without the guidance. Each arm is a git worktree of the +real repo — the agent sees actual source files. + +Usage: + uv run dev/skill-evals/eval.py Test AGENTS.md changes + uv run dev/skill-evals/eval.py --full Add baseline arm (no AGENTS.md) + uv run dev/skill-evals/eval.py --repeat 3 Reduce nondeterminism + +Authentication: Claude Code session (claude /login) or ANTHROPIC_API_KEY. +""" + +from __future__ import annotations + +import os +import shutil +import subprocess +import sys +import tempfile +from pathlib import Path + +PROMPTFOO_VERSION = "0.121.17" + +REPO_ROOT = Path(__file__).resolve().parent.parent.parent +SCRIPT_DIR = Path(__file__).resolve().parent +AGENTS_SRC = REPO_ROOT / "AGENTS.md" + +OUTPUT_SCHEMA = """\ + output_format: + type: json_schema + schema: + type: object + required: [should_create, rationale] + additionalProperties: false + properties: + should_create: + type: boolean + type: + type: string + enum: [bugfix, feature, improvement, doc, misc, significant] + rationale: + type: string""" + + +def run(cmd: list[str], **kwargs) -> subprocess.CompletedProcess[str]: + return subprocess.run(cmd, capture_output=True, text=True, check=False, **kwargs) + + +def check_prerequisites() -> None: + if not shutil.which("node"): + print("Error: Node.js not found. Install Node.js >=22.22.0", file=sys.stderr) + sys.exit(1) + if not shutil.which("npx"): + print("Error: npx not found.", file=sys.stderr) + sys.exit(1) + + sdk_dir = Path.home() / ".promptfoo-sdk" / "node_modules" / "@anthropic-ai" / "claude-agent-sdk" + if not sdk_dir.is_dir(): + print("Error: Claude Agent SDK not found. Run:", file=sys.stderr) + print( + " mkdir -p ~/.promptfoo-sdk && cd ~/.promptfoo-sdk" Review Comment: Small nits: that currently all the user generated content should be located under the `/files` artifact directory. This convention is also introduced in AGENTS.md recently by TP (might also be the classic case for eval?) Corresponding PR: - `files/` output convention in AGENTS.md: https://github.com/apache/airflow/pull/69097 --- Drafted-by: Claude Code (Fable 5) (PR links appended without human review before posting) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
