Getting started

AstroAKD-Bench evaluates astronomical archive-search agents. The benchmark creates questions and compares three agent configurations using a separately running Astroquery MCP server.

Prerequisites

  • Python 3.11+ and uv

  • An OPENAI_API_KEY in the environment when generating or running the agents

  • An Astroquery MCP server serving http://127.0.0.1:8000/mcp (or set ASTROAKD_MCP_URL)

  • Working ADS credentials on the MCP server if using --require-ads

Install the external Astroquery MCP server (Terminal 1)

In a separate terminal, from the directory where you want the independent server checkout:

git clone https://github.com/NASA-IMPACT/astroquery-mcp.git
cd astroquery-mcp
uv sync
uv run fastmcp run server.py --transport http --host 127.0.0.1 --port 8000

Keep the MCP server running while using the benchmark. The command starts the local endpoint at http://127.0.0.1:8000/mcp. For ADS-backed literature questions, set an ADS token (API_DEV_KEY or server-supported ADS_API_KEY) in the server process environment before starting it, then restart the server if its environment changes. Do not add the token to source files, questions or logs.

Install and check AstroAKD-Bench (Terminal 2)

In a second terminal, switch to your AstroAKD-Bench checkout, not the astroquery-mcp directory:

uv sync
uv run python -m benchmark --version
uv run python -m benchmark doctor --fast

Configure OPENAI_API_KEY securely in the benchmark terminal before generating questions or evaluating agents. To check literature search, run:

uv run python -m benchmark literature-auth --probe --query 'PG 1211+143'

The benchmark defaults to http://127.0.0.1:8000/mcp. Use ASTROAKD_MCP_URL (and optionally ASTROAKD_MCP_TOKEN for a protected MCP endpoint) only when connecting elsewhere. The MCP client token is distinct from the server-side ADS token. For details, see ADS and MCP connectivity.

Current v2 reference coverage and literature drafts (2026-10-19)

The current saved astroakd_100_v2 dataset contains 80 complete single-call references and 12 complete two-archive references. The recovered VizieR steps need no further retries; eight literature questions still lack verified paper-linked observation evidence. The offline scorer evaluates 92/100 questions. The literature draft command

uv run python -m benchmark draft-literature-plans \
  --name astroakd_100_v2 --output-dir datasets

has already produced datasets/validated/astroakd_100_v2_literature_plan_drafts.jsonl with DRAFT_ONLY_NOT_REFERENCE: six unverified candidate templates and two requiring target/archive resolution. These drafts are not runnable --literature-plans input and are not reference answers. Read Reference collection and scientific review before preparing independently verifiable literature-observation plans. No question regeneration or A/B/C reruns are necessary.

What is measured?

A is MCP only, B is MCP with the AstroAKD specialist instruction, and C is Web only. One hundred questions create up to 300 agent runs. Completion, time and tool metrics are not scientific correctness. Scientific accuracy requires independently verified gold answers.

Figure commands are separate from execution. run-benchmark saves agent runs; the subsequent agent-report command saves mean_runtime.png, total_tokens.png, completed_runs.png, mean_mcp_events.png, and web_search_calls.png to datasets/reports/astroakd_100_v2/agents/. To refresh plots, rerun agent-report --name astroakd_100_v2 --output-dir datasets --replace. For archive observations, reference-report --name astroakd_100_v2 --output-dir datasets --replace creates response_times.png and the other reference completeness figures under datasets/reports/astroakd_100_v2/references/. The current agent-report also generates question-aware automated archive-reference match_rate.png when there are automatically scorable complete reference records. It reports the scorable denominator and exclusions; it is not independently reviewed scientific accuracy.

Continue with question generation, references, and evaluation.

Frozen prompts: instructions/astroakd/AstroAKD_Instruction.md (arm B) and instructions/astroakd_bench/AstroAKD-Bench_Instruction.md (generation only).

To build the HTML documentation from the repository root: make -C docs/sphinx html.

Match-rate figure and selective MCP-only retry

For a saved astroakd_100_v2 dataset with single-call reference evidence, run uv run --with matplotlib python -m benchmark agent-report --name astroakd_100_v2 --output-dir datasets --replace. Alongside runtime and token plots this now creates datasets/reports/astroakd_100_v2/agents/match_rate.png, explicitly labeled automated archive-reference agreement on the currently evaluable denominator; read automated_scoring_summary.json for scorable/excluded counts. It is not verified scientific accuracy.

After a complete A/B/C run, uv run python -m benchmark run-benchmark --name astroakd_100_v2 --output-dir datasets --retry-errors --dry-run previews failed MCP-only tasks. Remove --dry-run and add --with openai to uv run, --max-turns 16 --max-calls 20 --timeout 900 --task-timeout 2400 to execute only those failed MCP-only tasks. A separate diagnostic journal is created; the original 300 runs are preserved. See A/B/C evaluation and plots.

New generation policy

Version 0.6.7.11.10 performs agent-independent, reference-aware MCP prechecks before GPT question writing when --with-reference-answers is selected. It tries bounded Gaia/MAST/HEASARC/VizieR queries, rejects incomplete/oversized/null results and selects alternate target/radius combinations. Accepted slots are frozen in a checksum-protected feasibility plan so --resume keeps the same questions and MCP calls. A precheck is not an independently validated reference answer. If no feasible 100-question candidate mix is available, the command fails before GPT rather than silently creating unscorable questions. For your fresh study use --name astroakd_100_v2 throughout; see Question creation.

If reference-aware probing stops before GPT writing, check datasets/generated/<name>_feasibility_progress.json and run the same create-queries command with --resume. This reuses saved MCP probes and accepted slots. When an archive has no complete, bounded candidate, the selector tries another archive and records the new distribution.