Evalstone
Evalstone

Library

The Python API and the evalstone.yaml file. On PyPI.

Released

evalstone is on PyPI: the library, the CLI, the MCP server, the pytest plugin and terminal labeling. Versions and changes are in the changelog.

Install

pip install evalstone

What needs a model and what does not, and how a judge reaches a provider: How it works.

Python API

import evalstone as es

ds = es.Dataset.from_jsonl("evals/golden.jsonl")

suite = es.Suite(
    "support-bot",
    dataset=ds,
    checks=[
        es.checks.json_schema(schema=Answer),
        es.checks.contains(path="must_include"),
        es.checks.judge("helpfulness", rubric=RUBRIC, scale=5,
                        model="anthropic/claude-haiku-5-5"),
        es.checks.rag.faithfulness(),
    ],
    gate=es.Gate(min_pass_rate=0.95, max_regression=0.02),
)

run = suite.run(target=my_app.answer)   # callable(sample.input) -> output
print(run.table())                       # per-check rows + totals (run.summary is the data)
suite.enforce(run)                       # raises es.GateFailed when the gate fails

A dataset line in golden.jsonl:

{"input": {"question": "Can I return a sale item?"},
 "expected": {"must_include": ["30 days", "original receipt"]},
 "tags": ["refund"]}

Writing a check

A check is a function. The built-ins are the same shape.

@es.check("no_apology")
def no_apology(sample, output):
    ok = "sorry" not in output.text.lower()
    return es.Score(value=float(ok), passed=ok,
                    reason="" if ok else "apologised")

evalstone.yaml

project: support-bot
datasets:
  golden: evals/golden.jsonl
suites:
  nightly:
    dataset: golden
    target: { kind: http, url: http://localhost:8000/answer }
    checks: [json_schema, helpfulness, faithfulness]
    gate: { min_pass_rate: 0.95, max_regression: 0.02 }
judges:
  default_model: anthropic/claude-haiku-5-5
providers:
  openai:    { base_url: https://api.openai.com/v1, api_key_env: OPENAI_API_KEY }
  anthropic: { api_key_env: ANTHROPIC_API_KEY }
center:    # optional — without it, runs print and write a JSON report only
  url: https://api.evalstone.com
  project: <project id from the center>
  api_key_env: EVALSTONE_API_KEY   # an es_… ingest key minted on the project

Model strings are <provider>/<model>. Providers: openai (any OpenAI-compatible base URL, so OpenRouter, Ollama and vLLM work), anthropic, gemini. Keys come from the environment and are never stored.

CLI

evalstone init                 # writes evalstone.yaml + evals/ (golden.jsonl, outputs.jsonl, checks.py)
evalstone run nightly          # table + evalstone-report.json
evalstone compare <run> <run>  # sample-by-sample diff
evalstone gate nightly         # exit code for CI
evalstone label <run>          # grade outputs in the terminal
evalstone mcp                  # start the MCP server (stdio)

Full details: the CLI, config and checks reference pages.

Guarantees

  • Cheap checks run first; judge verdicts are cached by (judge version, input, output) and priced. The cache lives in the process (one run, or one MCP session); attached to a center it lives there, shared across runs and machines.
  • A judge error is error, never pass; the gate fails above max_error_rate (default 0).
  • Every run records the dataset version, git SHA, cost and duration; each result records the judge version (which includes the model) that scored it.

On this page