Skip to main content
Glama

Evaluate With LLM Judge

evaluate_with_llm_judge

Score an output with an LLM judge on your key: get a 0–1 score, rationale, sub-scores, and exact cost. Templates cover accuracy, helpfulness, safety, correctness, and faithfulness.

Instructions

Score an output with an LLM judge on your own provider key: a 0..1 score, a rationale, per-dimension sub-scores and the exact spend.

What it does. Calls Anthropic or OpenAI directly with the key in this process's environment (IRIS_ANTHROPIC_API_KEY or IRIS_OPENAI_API_KEY); Iris never proxies. template picks the question: accuracy, helpfulness, safety, correctness (needs expected) or faithfulness (needs source_material); input improves helpfulness and safety. model is required; provider is inferred from it. The worst-case spend — both attempts, full max_output_tokens — is computed BEFORE the call and refused if it exceeds max_cost_usd (default IRIS_LLM_JUDGE_MAX_COST_USD_PER_EVAL or 0.25). temperature defaults to 0; a rate-limited call is retried once. One evaluation row is stored with the provider response id, tokens, cost and latency, linked to trace_id when given. The judge's own accuracy is measurable on a key you supply and is not yet published (see iris://proof).

When not to use it. For length, keyword, PII, injection or cost checks: evaluate_output is free and deterministic. Without a key: the call returns IRIS_JUDGE_NOT_ENABLED with the enable steps — do not search for them. On very large outputs without raising max_cost_usd: the pre-check refuses.

Returns. JSON with id (the evaluation id; read it back at iris://evaluations/{id}); trace_id (the linked trace, when one was named); score (0..1 from the judge); passed (the verdict: the score against the template's threshold, which is pass_threshold below. Not the model's own boolean — that is self_reported_pass); pass_threshold (the threshold the score was read against, so you can check the arithmetic); self_reported_pass (what the model said about passing, when it said anything. Recorded, never obeyed); disagreement (true when the model's own boolean disagrees with the threshold verdict — its rubric and its judgement have come apart on this output); rationale (the judge's reasoning, in its words); dimensions (per-dimension sub-scores for the template); model (the model that judged); provider (the provider called); template (the template used); input_tokens (tokens sent, across both attempts when a retry ran); output_tokens (tokens received, across both attempts when a retry ran); cost_usd (the exact spend from the pricing table); latency_ms (wall time of the provider call(s)); raw_response_id (the provider's response id, for your own audit).

Errors. IRIS_JUDGE_NOT_ENABLED (no key for the provider reached this process; recovery carries the steps). IRIS_JUDGE_UNKNOWN_MODEL (valid lists the models). IRIS_UNKNOWN_TRACE, checked before any spend. IRIS_BUDGET_EXCEEDED (nothing spent; the message carries both numbers). IRIS_PROVIDER_ERROR with kind auth, rate_limit, bad_request, server_error, timeout or malformed_response, and retryable set. Every failure returns {"error":{"code","message","recovery":[]}} with isError true; follow recovery before retrying.

Siblings. evaluate_output — the free deterministic path; verify_citations — citation grounding, the narrower judge; log_trace — record the execution first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputNoUser question / prompt that produced the output (improves accuracy for helpfulness/safety)
modelYesModel ID. Supported: anthropic = claude-opus-4-7 | claude-sonnet-4-6 | claude-haiku-4-5 | claude-haiku-4-5-20251001; openai = gpt-4o | gpt-4o-mini | o1-mini. Required — cost varies a hundredfold across models
outputYesThe agent output text to evaluate
expectedNoReference answer (required for correctness template)
providerNoAuto-detected from model when omitted
templateYesJudge dimension: accuracy (factual correctness), helpfulness (does it address the ask), safety (harm potential), correctness (vs reference answer — requires `expected`), faithfulness (RAG grounding — requires `source_material`).
trace_idNoLink this evaluation to a stored trace (id from log_trace / get_traces); an unknown id is rejected BEFORE the judge is called
timeout_msNoPer-request timeout; default 60_000
temperatureNoSampling temperature; default 0 (deterministic)
max_cost_usdNoCost cap in USD for this call; defaults to IRIS_LLM_JUDGE_MAX_COST_USD_PER_EVAL or 0.25. The worst case (two attempts, full max_output_tokens) is computed before the call and refused if it exceeds the cap
source_materialNoProvided RAG sources (required for faithfulness template)
max_output_tokensNoJudge output token cap; default 512

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesthe evaluation id; read it back at iris://evaluations/{id}
modelYesthe model that judged
scoreYes0..1 from the judge
passedYesthe verdict: the score against the template's threshold, which is pass_threshold below. Not the model's own boolean — that is self_reported_pass
cost_usdYesthe exact spend from the pricing table
providerYesthe provider called
templateYesthe template used
trace_idNothe linked trace, when one was named
rationaleYesthe judge's reasoning, in its words
dimensionsYesper-dimension sub-scores for the template
latency_msYeswall time of the provider call(s)
disagreementNotrue when the model's own boolean disagrees with the threshold verdict — its rubric and its judgement have come apart on this output
input_tokensYestokens sent, across both attempts when a retry ran
output_tokensYestokens received, across both attempts when a retry ran
pass_thresholdYesthe threshold the score was read against, so you can check the arithmetic
raw_response_idNothe provider's response id, for your own audit
self_reported_passNowhat the model said about passing, when it said anything. Recorded, never obeyed

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed5 schema fields changedv0.10.0
    • addedOutput schema / properties / disagreement
      Added value: +{
      +  "description": "true when the model's own boolean disagrees with the threshold verdict — its rubric and its judgement have come apart on this output",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / pass_threshold
      Added value: +{
      +  "description": "the threshold the score was read against, so you can check the arithmetic",
      +  "type": "number"
      +}
    • changedOutput schema / properties / passed / description
      Previous value: -"the judge's own pass verdict for the template"New value: +"the verdict: the score against the template's threshold, which is pass_threshold below. Not the model's own boolean — that is self_reported_pass"
    • addedOutput schema / properties / self_reported_pass
      Added value: +{
      +  "description": "what the model said about passing, when it said anything. Recorded, never obeyed",
      +  "type": "boolean"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "id",
      -  "score",
      -  "passed",
      -  "rationale",
      -  "dimensions",
      -  "model",
      -  "provider",
      -  "template",
      -  "input_tokens",
      -  "output_tokens",
      -  "cost_usd",
      -  "latency_ms"
      -]New value: +[
      +  "id",
      +  "score",
      +  "passed",
      +  "pass_threshold",
      +  "rationale",
      +  "dimensions",
      +  "model",
      +  "provider",
      +  "template",
      +  "input_tokens",
      +  "output_tokens",
      +  "cost_usd",
      +  "latency_ms"
      +]
  2. Changed3 schema fields changedv0.9.0
    • changedInput schema / properties / max_cost_usd / description
      Previous value: -"Cost cap in USD; defaults to IRIS_LLM_JUDGE_MAX_COST_USD_PER_EVAL or 0.25"New value: +"Cost cap in USD for this call; defaults to IRIS_LLM_JUDGE_MAX_COST_USD_PER_EVAL or 0.25. The worst case (two attempts, full max_output_tokens) is computed before the call and refused if it exceeds the cap"
    • changedInput schema / properties / model / description
      Previous value: -"Model ID. Supported: anthropic = claude-opus-4-7 | claude-sonnet-4-6 | claude-haiku-4-5 | claude-haiku-4-5-20251001; openai = gpt-4o | gpt-4o-mini | o1-mini."New value: +"Model ID. Supported: anthropic = claude-opus-4-7 | claude-sonnet-4-6 | claude-haiku-4-5 | claude-haiku-4-5-20251001; openai = gpt-4o | gpt-4o-mini | o1-mini. Required — cost varies a hundredfold across models"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": {},
      +  "properties": {
      +    "cost_usd": {
      +      "description": "the exact spend from the pricing table",
      +      "type": [
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "dimensions": {
      +      "additionalProperties": {},
      +      "description": "per-dimension sub-scores for the template",
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "id": {
      +      "description": "the evaluation id; read it back at iris://evaluations/{id}",
      +      "type": "string"
      +    },
      +    "input_tokens": {
      +      "description": "tokens sent, across both attempts when a retry ran",
      +      "type": "number"
      +    },
      +    "latency_ms": {
      +      "description": "wall time of the provider call(s)",
      +      "type": "number"
      +    },
      +    "model": {
      +      "description": "the model that judged",
      +      "type": "string"
      +    },
      +    "output_tokens": {
      +      "description": "tokens received, across both attempts when a retry ran",
      +      "type": "number"
      +    },
      +    "passed": {
      +      "description": "the judge's own pass verdict for the template",
      +      "type": "boolean"
      +    },
      +    "provider": {
      +      "description": "the provider called",
      +      "enum": [
      +        "anthropic",
      +        "openai"
      +      ],
      +      "type": "string"
      +    },
      +    "rationale": {
      +      "description": "the judge's reasoning, in its words",
      +      "type": "string"
      +    },
      +    "raw_response_id": {
      +      "description": "the provider's response id, for your own audit",
      +      "type": "string"
      +    },
      +    "score": {
      +      "description": "0..1 from the judge",
      +      "type": "number"
      +    },
      +    "template": {
      +      "description": "the template used",
      +      "type": "string"
      +    },
      +    "trace_id": {
      +      "description": "the linked trace, when one was named",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "id",
      +    "score",
      +    "passed",
      +    "rationale",
      +    "dimensions",
      +    "model",
      +    "provider",
      +    "template",
      +    "input_tokens",
      +    "output_tokens",
      +    "cost_usd",
      +    "latency_ms"
      +  ],
      +  "type": "object"
      +}
  3. Changed2 schema fields changedv0.8.0
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / trace_id / description
      Previous value: -"Link this evaluation to a trace"New value: +"Link this evaluation to a stored trace (id from log_trace / get_traces); an unknown id is rejected BEFORE the judge is called"
  4. Changed2 schema fields changedv0.4.6
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / timeout_ms / maximum
      Added value: +9007199254740991
  5. Addedv0.1.10

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description goes far beyond annotations, disclosing that Iris never proxies, that spend is pre-computed and capped before the call, that rate-limited calls retry once, that temperature defaults to 0, and that a row is stored with provider response id/tokens/cost/latency. It even explains that self_reported_pass is recorded but never obeyed, and that the pre-check refuses before spending. No contradiction with annotations (readOnlyHint=false, destructiveHint=false) — the write/store behavior is consistent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long, but every section earns its place: What it does, When not to use it, Returns, Errors, Siblings. It is structured with headers and front-loaded with the essential purpose and cost/behavior caveats. Some redundancy exists (the template requirements are stated both in prose and in schema descriptions, and the return field list is exhaustive), but the structure makes it navigable and scannable. Not a 5 because it could be tightened by trimming the full return-field enumeration that the output schema already documents.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 12-parameter, externally-calling, cost-bearing tool with an output schema, the description covers everything an agent needs: what happens before the call (budget pre-check, trace validation), what happens during (retry, direct provider call), what is returned (mapped to the output schema), what errors look like (codes + recovery), and explicit when-not-to-use conditions. The error-code enumeration is especially valuable because the output schema exists but the error shape is partially described. This is as complete as a description of this complexity practically needs to be.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds substantive meaning beyond the schema: it explains template-purpose mapping in prose, clarifies model cost variance ('hundredfold'), states how max_cost_usd is applied ('worst case computed before the call'), and defines temperature default determinism. It doesn't fully re-explain every parameter, but it enriches the key decision parameters enough to push above baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb ('Score an output'), a precise resource ('with an LLM judge on your own provider key'), and enumerates concrete outputs (0..1 score, rationale, sub-scores, spend). It clearly distinguishes itself from siblings by naming exactly what it is not (evaluate_output, verify_citations) and describing its provider-direct behavior. An agent can identify what this tool does without guessing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description contains an explicit 'When not to use it' section that names alternatives (evaluate_output for deterministic checks) and conditions (no key -> not enabled; large outputs -> budget refusal). It also explains template selection requirements (correctness needs expected, faithfulness needs source_material) and how provider/model relate. This is comprehensive routing guidance beyond what the schema provides.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/iris-eval/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server