Evals-as-Code (eac)

eac is a command line tool & SDKs to write evals for AI systems.

It handles fixtures, running and judging your AI system, all configurable through code.

~/my-app

Get started

Offline evals run your AI system on cases you write, and judge what it does.

  1. Install the CLI

    On macOS or Linux.
    curl -fsSL https://eac.sentry.dev/install | bash
  2. Install the Python SDK

    Into the environment your evals run in.
    # needs Python 3.11+
    pip install eac-sdk
  3. Write an eval

    Add a dataset.yml anywhere in your repo, with an offline section: the runner that calls your system, and the cases to run it on.
    evals/chat/dataset.yml
    name: chat
    runtime: python
    offline:
      runner: ./dataset.py:ChatRunner
      cases: ./dataset.py:CASES
    evals/chat/dataset.py
    from typing import Any
    
    from eac import Case, Judge, OfflineRunner, Score
    from openai import OpenAI
    
    
    class ChatRunner(OfflineRunner):
    
        def run_case(
            self,
            case: Case,
            *,
            seed_results: dict[str, dict[str, Any]],
            conversation_id: str,
        ) -> dict[str, Any]:
            response = OpenAI().responses.create(
                model="gpt-6-luna",
                instructions="You're a friendly assistant. Reply in one short sentence.",
                input=case.input["query"],
            )
            return {"response": response.output_text}
    
    
    class GreetsJudge(Judge):
        name = "greets_judge"
    
        def judge(
            self,
            case: Case,
            *,
            seed_results: dict[str, dict[str, Any]],
            agent_trace: Any = None,
        ) -> Score | None:
            response = case.run_results.get("response", "")
            if response.lower().startswith(("hello", "hi", "hey")):
                return Score(name=self.name, score=1.0)
    
            return Score(
                name=self.name,
                score=0.0,
                explanation=f"no greeting in {response!r}",
            )
    
    
    CASES = [
        Case(name="greeting", input={"query": "hi"}, judges=[GreetsJudge()]),
        Case(name="goodbye", input={"query": "bye"}, judges=[GreetsJudge()]),
    ]
  4. Run it

    eac seeds fixtures, runs each case, judges the output and prints the results.
    eac offline run --dataset chat
    It prints the run at the top of this page: greeting passes, goodbye fails.

Learn more

Judges, seeds, online evals and the full CLI reference.Read the docs