agenta-3-evaluation-metrics-and-testing
Sub-skill of agenta: 3. Evaluation Metrics and Testing.
Best use case
agenta-3-evaluation-metrics-and-testing is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Sub-skill of agenta: 3. Evaluation Metrics and Testing.
Teams using agenta-3-evaluation-metrics-and-testing should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/3-evaluation-metrics-and-testing/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How agenta-3-evaluation-metrics-and-testing Compares
| Feature / Agent | agenta-3-evaluation-metrics-and-testing | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Sub-skill of agenta: 3. Evaluation Metrics and Testing.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 3. Evaluation Metrics and Testing
## 3. Evaluation Metrics and Testing
**Automated Evaluation Pipeline:**
```python
"""
Evaluate prompts with automated metrics.
"""
import agenta as ag
from agenta import Agenta
from typing import List, Dict, Callable, Any
from dataclasses import dataclass
import json
@dataclass
class EvaluationResult:
"""Result of an evaluation."""
metric_name: str
score: float
details: Dict[str, Any]
class MetricEvaluator:
"""Base class for evaluation metrics."""
def __init__(self, name: str):
self.name = name
def evaluate(
self,
output: str,
expected: str = None,
context: Dict = None
) -> EvaluationResult:
raise NotImplementedError
class ExactMatchMetric(MetricEvaluator):
"""Exact match evaluation."""
def __init__(self):
super().__init__("exact_match")
def evaluate(self, output: str, expected: str = None, context: Dict = None) -> EvaluationResult:
if expected is None:
return EvaluationResult(self.name, 0.0, {"error": "No expected value"})
match = output.strip().lower() == expected.strip().lower()
return EvaluationResult(
metric_name=self.name,
score=1.0 if match else 0.0,
details={"match": match}
)
class ContainsMetric(MetricEvaluator):
"""Check if output contains expected keywords."""
def __init__(self, keywords: List[str]):
super().__init__("contains_keywords")
self.keywords = keywords
def evaluate(self, output: str, expected: str = None, context: Dict = None) -> EvaluationResult:
output_lower = output.lower()
found = [kw for kw in self.keywords if kw.lower() in output_lower]
score = len(found) / len(self.keywords)
return EvaluationResult(
metric_name=self.name,
score=score,
details={
"found_keywords": found,
"missing_keywords": [kw for kw in self.keywords if kw.lower() not in output_lower]
}
)
class LengthMetric(MetricEvaluator):
"""Evaluate output length."""
def __init__(self, min_length: int = 10, max_length: int = 500):
super().__init__("length")
self.min_length = min_length
self.max_length = max_length
def evaluate(self, output: str, expected: str = None, context: Dict = None) -> EvaluationResult:
length = len(output.split())
if self.min_length <= length <= self.max_length:
score = 1.0
elif length < self.min_length:
score = length / self.min_length
else:
score = max(0, 1 - (length - self.max_length) / self.max_length)
return EvaluationResult(
metric_name=self.name,
score=score,
details={
"word_count": length,
"min_length": self.min_length,
"max_length": self.max_length
}
)
class LLMJudgeMetric(MetricEvaluator):
"""Use an LLM to judge output quality."""
def __init__(self, criteria: str = "helpfulness"):
super().__init__(f"llm_judge_{criteria}")
self.criteria = criteria
def evaluate(self, output: str, expected: str = None, context: Dict = None) -> EvaluationResult:
judge_prompt = f"""Evaluate the following response on {self.criteria}.
Score from 0.0 to 1.0.
Response:
{output}
{f'Expected: {expected}' if expected else ''}
Provide your evaluation as JSON: {{"score": 0.0-1.0, "reasoning": "..."}}
"""
response = ag.llm.complete(
prompt=judge_prompt,
model="gpt-4",
temperature=0
)
try:
result = json.loads(response.text)
score = float(result.get("score", 0.5))
reasoning = result.get("reasoning", "")
except (json.JSONDecodeError, ValueError):
score = 0.5
reasoning = "Failed to parse judge response"
return EvaluationResult(
metric_name=self.name,
score=score,
details={"reasoning": reasoning, "criteria": self.criteria}
)
class EvaluationPipeline:
"""
Pipeline for running multiple evaluations.
"""
def __init__(self, app_name: str):
self.app_name = app_name
self.client = Agenta()
self.metrics: List[MetricEvaluator] = []
def add_metric(self, metric: MetricEvaluator) -> 'EvaluationPipeline':
"""Add a metric to the pipeline."""
self.metrics.append(metric)
return self
def evaluate_single(
self,
output: str,
expected: str = None,
context: Dict = None
) -> Dict[str, EvaluationResult]:
"""
Evaluate a single output with all metrics.
Args:
output: Generated output
expected: Expected output (optional)
context: Additional context
Returns:
Dictionary of metric results
"""
results = {}
for metric in self.metrics:
result = metric.evaluate(output, expected, context)
results[metric.name] = result
return results
*Content truncated — see parent skill for full reference.*Related Skills
library-evaluation-integration
Create evaluation scripts and integration tests for Python scientific libraries in the digitalmodel package. Follows the established pattern from fluids, ht, meshio, sectionproperties, and pygmt evaluations.
webapp-testing
Web application testing toolkit using Playwright with Python. Use for verifying frontend functionality, debugging UI behavior, capturing browser screenshots, viewing browser logs, and automating web interactions.
testing-tdd-london
TDD London School (mockist) specialist for mock-driven, outside-in development. Use for behavior verification testing, contract-driven development, testing object collaborations, or when focusing on HOW objects interact rather than WHAT they contain.
testing-production
Production validation specialist ensuring applications are fully implemented and deployment-ready. Use to verify no mock/stub/fake implementations remain, validate against real databases and APIs, perform end-to-end testing with actual systems, and confirm production readiness.
metrics-tracking
Define, track, and analyze product metrics with frameworks for goal setting and dashboard design
github-actions-2-matrix-builds-for-cross-platform-testing
Sub-skill of github-actions: 2. Matrix Builds for Cross-Platform Testing.
oil-and-gas-volumetrics
Sub-skill of oil-and-gas: Volumetrics (+3).
oil-and-gas-economic-evaluation
Sub-skill of oil-and-gas: Economic Evaluation (+2).
orcaflex-static-debug-incremental-static-testing
Sub-skill of orcaflex-static-debug: Incremental Static Testing (+1).
gmsh-meshing-quality-metrics
Sub-skill of gmsh-meshing: Quality Metrics (+1).
freecad-automation-performance-metrics
Sub-skill of freecad-automation: Performance Metrics.
webapp-testing-wait-for-dynamic-content
Sub-skill of webapp-testing: Wait for Dynamic Content (+5).