shihongDev/evalyn
About
Evalyn — a lightweight, local-first eval framework for your GenAI app
AI & Machine LearningMeasured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Original
Local-first evaluation framework for LLM agents
Evalyn focuses on making GenAI App evaluation practical and easy. It provides lightweight tracing, human-in-the-loop annotation, metric suggestion, and calibration workflows to help developers/non-tech folks understand what to evaluate, align metrics with real usage, and continuously improve your GenAI App behavior over time.
Why Evalyn?
| Fully Local | All data stays on your machine. SQLite storage, no cloud dependencies. |
| Easy Onboarding | Just import evalyn_sdk - LLM calls auto-captured with tokens & cost. |
| Metric Bank | 136 built-in metrics (76 objective, 60 LLM judges) - including audio, image, and video evaluation. Community contributions welcome. |
| Auto Calibration | 9 calibration optimizers (GEPA, APE, OPRO, EvoPrompt, TextGrad, MIPROv2, PromptBreeder, and more) plus active learning, curriculum learning, ensemble fusion, and sensitivity analysis. |
| 14 Instrumentors | Auto-captures OpenAI, Anthropic, Gemini, xAI, LangChain, LangGraph, Google ADK, Claude Agent SDK, CrewAI, AutoGen, DSPy, Haystack, LlamaIndex, Semantic Kernel. |
| Deep Analysis | 75+ analysis modules: cohort analysis, confusion matrices, cost dashboards, forecasting, root cause analysis, what-if simulation, and more. |
| One Command | Run the entire pipeline with evalyn one-click. |
The Pipeline
┌──────────────────────────────────────────────────────────────────┐
│ 1. COLLECT │
│ │
│ @eval -> TRACE (SQLite) │
│ list-calls / show-call │
│ show-trace -v / show-span │
│ show-projects / delete-traces │
└──────────────────────────────────────────────────────────────────┘
|
v
┌──────────────────────────────────────────────────────────────────┐
│ 2. BUILD │
│ │
│ build-dataset -> DATASET (JSONL) │
│ --mode random/diverse/stratified/clustered │
│ --deduplicate │
│ validate / status │
└──────────────────────────────────────────────────────────────────┘
|
v
┌──────────────────────────────────────────────────────────────────┐
│ 3. EVALUATE │
│ │
│ suggest-metrics -> run-eval -> ANALYZE │
│ select-metrics show-run analyze / compare / trend │
│ list-metrics list-runs insights / dashboard │
│ export │
└──────────────────────────────────────────────────────────────────┘
|
v
┌──────────────────────────────────────────────────────────────────┐
│ 4. CALIBRATE │
│ │
│ annotate -> calibrate -> run-eval --use-calibrated │
│ (Human) list-calibrations │
│ │
│ annotation-stats / import-annotations │
│ cluster-failures / cluster-misalignments │
└──────────────────────────────────────────────────────────────────┘
|
v
┌──────────────────────────────────────────────────────────────────┐
│ 5. EXPAND │
│ │
│ simulate -> synthetic queries -> Back to Step 3 │
│ │
└──────────────────────────────────────────────────────────────────┘
Install
# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create virtual environment (Python 3.10+)
uv venv --python 3.10
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install the SDK
uv pip install -e "./sdk[llm]"
# To run the example agent, also install agent dependencies:
uv pip install -e "./sdk[agent]"
Optional: Dashboard (localhost IDE)
evalyn-dashboard is a separate optional package that ships a localhost web IDE for running any of the 35 evalyn CLIs from auto-generated forms, watching streamed subprocess output, and chatting with an AI agent that calls evalyn commands as tools. New users get short visual walk-throughs of each tab on first visit (toggle from the Tours button in the header). Distributed separately to keep core evalyn lightweight.
pip install evalyn-dashboard
evalyn dashboard # opens http://localhost:7401
See dashboard/README.md for setup, provider configuration (OpenAI / Anthropic / Ollama), and the agent flow.
Note: the previous static HTML insights report is now evalyn report. The evalyn dashboard command now launches the localhost web IDE (when evalyn-dashboard is installed); when that package is not installed, evalyn dashboard falls back to producing the static HTML report as a deprecation alias.
Quick Start (Example Gemini Deep Research Agent)
1. Instrument Your Agent
from evalyn_sdk import eval
@eval(project="myapp", version="v1")
def my_agent(query: str) -> str:
return call_llm(query) # LLM calls auto-captured
2. Run the Agent
export GEMINI_API_KEY="your_api_key" # This is for the example agent itself
python example_agents/langchain_deep_research_agent/agent.py "What is the current status of AI Agents?"
evalyn init # Create evalyn.yaml config and edit evalyn.yaml to set your GEMINI_API_KEY. This is for llm judge setup
3. Choose Your Workflow
Option A: Quickstart (Guided) - Interactive walkthrough for new users
evalyn quickstart # Detect framework, instrument, configure
Option B: One-Click (Automated) - Run the full pipeline in one command
evalyn one-click --project gemini-deep-research-agent # Dataset -> Metrics -> Eval -> Report
Option C: Step-by-Step (Manual) - See Sample Workflow for granular control over each step.
Sample Workflow
For users who want manual control over each step. For automated pipeline, use
evalyn one-clickinstead.
Step 1: Instrument & Collect
# Add @eval decorator to the agent, then run it (already added for example agents)
evalyn list-calls
id | function | project | status | duration_ms
---------|----------------|-----------------------------|---------|-----------
960912fa | research_agent | gemini-deep-research-agent | OK | 21215.61
75489541 | research_agent | gemini-deep-research-agent | OK | 22097.82
2567ea62 | chat | anthropic-research-agent | OK | 1461418.96
Tip: Use
evalyn show-call --id 960912fato view trace details with short ID prefix.
Step 2: Build Dataset
evalyn build-dataset --project gemini-deep-research-agent
Wrote 137 items to data/prod/datasets/gemini-deep-research-agent-v0-20260127-054032/dataset.jsonl
Hint: To suggest metrics, run: evalyn suggest-metrics --dataset <path> --mode basic
Step 3: Select Metrics
Use --mode llm-registry to pick from 136 built-in metrics via LLM selection:
evalyn suggest-metrics --dataset <dataset-path> --mode llm-registry
- helpfulness_accuracy [subjective] :: PASS if the output answers the user question accurately
- factual_accuracy [subjective] :: PASS if factual claims are accurate and verifiable
- output_nonempty [objective] :: PASS if output is not empty/None
- latency_ms [objective] :: Measure execution latency in milliseconds
- url_count [objective] :: Counts URLs in the output (proxy for citations)
Saved metrics to <dataset-path>/metrics/metrics.json
Use --mode llm-brainstorm --append to generate custom metrics:
evalyn suggest-metrics --dataset <dataset-path> --mode llm-brainstorm --append
- completeness_of_explanation [subjective] :: Evaluates if the explanation covers core aspects
- clarity_and_readability [subjective] :: Assesses how easy the explanation is to understand
- relevance_to_question [subjective] :: Determines if output directly answers the question
- source_credibility_and_integration [subjective] :: Evaluates quality of cited sources
- conciseness_and_efficiency [subjective] :: Measures whether explanation avoids verbosity
Appending 5 new metric(s) to 5 existing.
Step 4: Run Evaluation
evalyn run-eval --dataset <dataset-path>
Loaded 10 metrics (3 objective, 7 subjective)
Dataset: 137 items
Eval run 220e8590-2ccd-4cb5-a585-a0110285e786
Run folder: <dataset-path>/eval_runs/20260127-055659_220e8590
results.json - evaluation data
report.html - analysis report
Results:
--------------------------------------------------------------------------------
Metric Type Count Avg Score Pass Rate Errors
--------------------------------------------------------------------------------
output_nonempty [obj] 137 1.0000 100.0% -
latency_ms [obj] 137 23986.3494 N/A -
url_count [obj] 137 55.1825 100.0% -
factual_accuracy [llm] 137 0.8015 79.6% 1
clarity_and_readability [llm] 137 1.0000 97.1% 4
helpfulness_accuracy [llm] 137 0.9850 95.6% 4
--------------------------------------------------------------------------------
Token usage: 10,048,041 input + 70,929 output = 10,118,970 total ($1.03)
Step 5: Analyze Results
evalyn analyze --run 220e8590
======================================================================
METRIC SUMMARY
======================================================================
[FAIL] factual_accuracy 109/137 passed (80%) avg=0.80
[FAIL] conciseness_and_efficiency 124/137 passed (91%) avg=0.91
[PASS] output_nonempty 137/137 passed (100%) avg=1.00
[PASS] url_count 137/137 passed (100%) avg=55.18
======================================================================
INSIGHTS
======================================================================
'latency_ms' has the highest failure rate. Consider reviewing the rubric.
2 metric(s) have 100% pass rate: output_nonempty, url_count
Overall health is MODERATE (85% pass rate)
======================================================================
RECOMMENDATIONS
======================================================================
1. Run 'evalyn annotate' to provide human labels for failed items
2. Run 'evalyn calibrate' to improve metric alignment
Step 6: Annotate & Calibrate (Optional)
evalyn annotate --latest
======================================================================
INTERACTIVE ANNOTATION
======================================================================
Dataset: data/prod/datasets/gemini-deep-research-agent-v0-.../dataset.jsonl
Items to annotate: 137
Using eval run: 220e8590...
Commands: [y]es/pass [n]o/fail [s]kip [v]iew full [q]uit
======================================================================
Item 1/137 [960912fa-637...]
INPUT: {"question": "What is antimatter?", ...}
OUTPUT: Antimatter is a form of matter that is the counterpart to...
LLM JUDGE RESULTS:
factual_accuracy: PASS
clarity_and_readability: PASS
helpfulness_accuracy: PASS
Pass? [y/n/s/v/q]:
After annotation, calibrate LLM judges to align with human feedback:
evalyn calibrate --metric-id factual_accuracy --annotations annotations.jsonl
evalyn run-eval --dataset <dataset-path> --use-calibrated
Step 7: Expand with Simulation (Optional)
evalyn simulate --dataset <dataset-path> --modes similar,outlier
evalyn run-eval --dataset <dataset-path>/simulations/sim-similar-...
Key Commands
| Command | What it does |
|---|---|
evalyn one-click --project X |
Run full pipeline |
evalyn list-calls |
View captured traces |
evalyn show-call --id abc123 |
View trace details (supports short IDs) |
evalyn show-call --last |
View most recent trace |
evalyn show-trace --last -v |
View span tree with details |
evalyn show-span --call-id X --span Y |
Inspect single span |
evalyn delete-traces -n 5 --db test |
Delete traces from storage |
evalyn build-dataset --project X |
Create dataset from traces |
evalyn suggest-metrics --project X --dataset D |
Get metric recommendations |
evalyn run-eval --dataset D |
Run evaluation + generate HTML report (use --provider for OpenAI/Ollama) |
evalyn show-run --last |
View most recent eval run |
evalyn insights --latest |
Comprehensive insights with correlations, regressions, recommendations |
evalyn insights --latest --deep |
Add LLM expert panel analysis |
evalyn insights --latest --format html |
Generate interactive HTML dashboard |
evalyn trend --project X |
View metric trends across eval runs |
evalyn annotate --dataset D |
Human annotation (interactive) |
evalyn calibrate --metric-id X |
Calibrate LLM judge |
evalyn simulate --dataset D |
Generate synthetic test data |
evalyn report --latest |
Generate and open the interactive HTML insights report in your browser |
evalyn dashboard |
Launch the localhost web IDE (requires evalyn-dashboard package) |
evalyn quickstart |
Guided first-run experience: detect framework, instrument, configure |
evalyn workflow |
Show evaluation workflow and next steps |
Environment Variables
| Variable | Description |
|---|---|
GEMINI_API_KEY |
Gemini API key for LLM judges (default provider) |
OPENAI_API_KEY |
OpenAI API key for judges when using --provider openai |
EVALYN_NO_HINTS |
Set to 1 to suppress hint messages |
EVALYN_AUTO_INSTRUMENT |
Set to off to disable auto-patching |
EVALYN_DB |
Custom path for the SQLite trace database |
EVALYN_ENV |
Environment name (development, production) for conditional tracing |
EVALYN_NO_COLOR |
Disable colored CLI output |
EVALYN_LOG_LEVEL |
Logging verbosity (DEBUG, INFO, WARNING, ERROR) |
EVALYN_LOG_FILE |
Path to write log output to a file |
EVALYN_LOG_FORMAT |
Set to json for JSON-formatted logs |
EVALYN_OTEL |
Set to off to disable OpenTelemetry tracing (default on) |
EVALYN_PROFILE |
Select a config profile (e.g., ci, local) |
Documentation
CLI Reference
| Command | Description |
|---|---|
| one-click | Run full evaluation pipeline |
| init | Initialize config file |
| quickstart | Guided first-run experience |
| dashboard | Generate static HTML insights report (deprecated alias for report when evalyn-dashboard is not installed; launches the localhost web IDE otherwise) |
| workflow | Show evaluation workflow and next steps |
| status | Show dataset status overview |
| Tracing | |
| list-calls | List captured traces |
| show-call | View trace details |
| show-trace | View span tree (with -v for details) |
| show-span | View single span details |
| show-projects | View project summaries |
| delete-traces | Delete traces from storage |
| Dataset | |
| build-dataset | Create dataset from traces |
| validate | Validate dataset format |
| Metrics | |
| suggest-metrics | Get metric recommendations |
| select-metrics | LLM-guided metric selection |
| list-metrics | List available metric templates |
| Evaluation | |
| run-eval | Run evaluation + generate report |
| list-runs | List past eval runs |
| show-run | View eval run details |
| analyze | Analyze eval run insights |
| insights | Comprehensive insights with expert panel and HTML dashboard |
| compare | Compare two eval runs |
| trend | View metric trends across runs |
| export | Export results (JSON/CSV/MD/HTML) |
| Annotation & Calibration | |
| annotate | Human annotation (interactive) |
| annotation-stats | Show annotation statistics |
| export-for-annotation | Export for external annotation |
| import-annotations | Import annotations from file |
| calibrate | Calibrate LLM judges |
| list-calibrations | List calibration records |
| cluster-failures | Cluster and analyze failures |
| cluster-misalignments | Cluster human/LLM disagreements |
| Simulation | |
| simulate | Generate synthetic test data |
Guides
| Guide | Description |
|---|---|
| technical-manual.md | Architecture & internals |
Claude Code Skills
Evalyn includes Claude Code skills that let Claude guide you through the full evaluation pipeline. Instead of reading docs and figuring out which commands to run, you describe what you want and Claude handles the workflow - detecting your framework, picking metrics based on your actual traces, and interpreting results.
Install
cp -r sdk/skills/evalyn-* ~/.claude/skills/
This copies the skills to your personal Claude Code skills directory. They will be available in all projects.
Skills
| Skill | Triggers when you... | What Claude does |
|---|---|---|
evalyn-setup |
Want to instrument an agent | Detects your framework, adds the @eval decorator, verifies traces are captured |
evalyn-eval |
Want to evaluate your agent | Builds a dataset, inspects your traces to recommend metric bundles, runs evaluation |
evalyn-analyze |
Want to understand eval results | Runs progressive analysis, clusters failures, interprets pass rates, recommends next steps |
evalyn-calibrate |
Think judges are too strict/lenient | Guides annotation, runs calibration optimizers, re-evaluates with tuned judges |
Usage
Start a Claude Code session and describe what you need. Claude picks the right skill automatically:
> "Help me set up evaluation for my agent" -> evalyn-setup
> "Evaluate my agent's performance" -> evalyn-eval
> "What do the evaluation results mean?" -> evalyn-analyze
> "The judges seem too strict on factual_accuracy" -> evalyn-calibrate
Skills chain together. After setup completes, Claude suggests moving to eval. After eval, it suggests analyze. If pass rates are low, it suggests calibrate. You can also jump to any skill directly.
How it works
Each skill gives Claude:
- Pre-flight checks - verifies prerequisites before starting (e.g., traces exist before building a dataset)
- Exact CLI commands - no guessing, no hallucinated flags
- Data-driven decisions - metric recommendations come from inspecting your actual traces, not abstract questions
- Interpretation guidance - what pass rates mean, when to calibrate vs. fix the agent
Testing
# Run all tests
uv run pytest tests/ -v
# Run with coverage
uv run pytest tests/ --cov=evalyn_sdk --cov-report=term-missing
# Run core unit tests only (no subprocess CLI tests)
uv run pytest tests/test_analysis.py tests/test_models_extended.py tests/test_storage.py tests/test_cli_utils.py tests/test_metrics_extended.py tests/test_cli_export.py tests/test_insights.py
The test suite has 17,400+ tests across 460+ files covering analysis engine, model serialization, storage, CLI commands, export formats, metrics, tracing, instrumentation, calibration, sampling, simulation, integration, and more. See CONTRIBUTING.md for details on the test structure and writing tests.
Example
See example_agents/ for SDK integrations:
- LangChain Deep Research: Auto-instrumentation via callback handler
- Claude Agent SDK (Anthropic): Hook-based integration (see technical manual)
- Google ADK Academic Research: Automatic callback injection (see technical manual)
Supported Auto-Instrumentation
Evalyn auto-patches these providers when @eval is applied - no manual setup needed:
| LLM Providers | Agent Frameworks |
|---|---|
| OpenAI | LangChain |
| Anthropic | LangGraph |
| Gemini | Google ADK |
| xAI (Grok) | Claude Agent SDK |
| CrewAI | |
| AutoGen | |
| DSPy | |
| Haystack | |
| LlamaIndex | |
| Semantic Kernel |
Contribution
We welcome community-contributed metrics. Upload your own evaluation metrics to help grow the open-source metric bank.
Step 1: Choose Metric Type
Decide whether your metric is:
- Objective: Code-based evaluation (regex, JSON parsing, numeric checks, etc.)
- Subjective: LLM judge-based evaluation (requires rubric and prompt)
Step 2: Define Your Metric
For objective metrics, add to sdk/evalyn_sdk/metrics/objective.py:
{
"id": "your_metric_name", # Unique snake_case identifier
"type": "objective",
"description": "What this metric measures.",
"config": {}, # Any configurable parameters
"category": "structure", # One of: efficiency, structure, robustness, correctness, grounding, style, diversity
"scope": "overall", # One of: overall, llm_call, tool_call, trace
"requires_reference": False, # True if needs human_label.reference
"author": "Your Name <email>", # Optional: credit for your contribution
}
For subjective metrics, add to sdk/evalyn_sdk/metrics/subjective.py:
{
"id": "your_metric_name",
"type": "subjective",
"description": "What this metric evaluates.",
"category": "correctness", # One of: safety, correctness, style, instruction, grounding, completeness, agent, ethics, domain, ux, conversation, creativity, explanation, persona, summarization, argumentation, accessibility
"scope": "overall",
"prompt": "You are a judge for X. Evaluate whether...",
"config": {
"rubric": [
"Criterion 1: what to check.",
"Criterion 2: what to check.",
"If ANY issue is found, FAIL and explain.",
],
"threshold": 0.5,
},
"requires_reference": False,
"author": "Your Name <email>", # Optional: credit for your contribution
}
Step 3: Implement the Evaluation Logic (Objective Only)
For objective metrics, add a handler function in sdk/evalyn_sdk/metrics/objective.py:
def compute_your_metric_name(output: str, config: dict, **kwargs) -> dict:
"""Evaluate your metric."""
# Your logic here
score = ...
passed = score > config.get("threshold", 0.5)
return {"score": score, "passed": passed, "reason": "Explanation"}
Then register it via register_builtin_metrics() in the same file.
Step 4: Add Tests
Add tests in tests/test_metrics.py to verify your metric works correctly:
def test_your_metric_name():
result = compute_your_metric_name("test output", {})
assert "score" in result
assert "passed" in result
Step 5: Submit a Pull Request
- Fork the repository
- Create a branch:
git checkout -b add-metric-your_metric_name - Make your changes
- Run tests:
uv run pytest tests/ - Submit a PR with:
- Description of what the metric measures
- Example use cases
- Test results
Field Reference
| Field | Required | Description |
|---|---|---|
id |
Yes | Unique snake_case identifier |
type |
Yes | objective or subjective |
description |
Yes | Brief explanation of what it measures |
category |
Yes | Metric category for grouping |
scope |
Yes | What the metric evaluates: overall, llm_call, tool_call, trace |
config |
Yes | Configuration options (can be empty {}) |
requires_reference |
Yes | Whether human_label.reference is needed |
prompt |
Subjective only | System prompt for the LLM judge |
author |
No | Your name/email for attribution |
License
MIT
Contact
Submit issues on GitHub or email [email protected]
Explore related projects
Loading…