Push scores onto traces, define custom evaluators with @eval, and import results from DeepEval / LangSmith.
The evaluations API has three layers: push (eval, score, batch_eval, external helpers), read (get_eval_breakdown), and define (@eval decorator for client-side evaluators). See the Evaluations guide for the conceptual model.
Define evaluators that run client-side before trace upload:
from decimalai.evals import eval, TraceData, EvalResult@eval(name="has_citation", category="quality")def check_citation(trace: TraceData) -> bool: """Returns True if the output contains a citation.""" return "[source:" in trace.output@eval(name="response_length", category="quality")def check_length(trace: TraceData) -> EvalResult: """Check response length is reasonable.""" length = len(trace.output) return EvalResult( score=min(length / 500, 1.0), passed=50 < length < 2000, reason=f"Length: {length} chars", )# Register evals with your framework.# The evals= kwarg lives on the LangChain adapter's install():from decimalai.langchain import installinstall(agent_name="my-agent", evals=[check_citation, check_length])
The @eval decorator also accepts category="llm_judge" (for judge-style scorers), sampling_rate (a 0.0–1.0 fraction of traces to evaluate), and version (a string tag for the evaluator definition). See the Evaluations guide for built-in evaluators and sampling configuration.