Grafana Cloud

Evaluation API

Note

Agent Observability Evaluations is currently in public preview. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available.

The Grafana Agent Observability evaluation control plane API manages evaluators, rules, guard rules, saved conversations, test suites, experiments, and judge provider discovery. Experiments are available in public preview for offline runs recorded by SDKs, CI jobs, and benchmark processes.

Manage evaluators

Use evaluator endpoints to create and list scoring definitions.

MethodPathDescription
GET/api/v1/eval/evaluatorsList all evaluators.
POST/api/v1/eval/evaluatorsCreate an evaluator.
GET/api/v1/eval/evaluators/{id}Get an evaluator by ID.
DELETE/api/v1/eval/evaluators/{id}Delete an evaluator.
GET/api/v1/eval/predefined/evaluatorsList predefined evaluators.
POST/api/v1/eval/predefined/evaluators/{id}:forkFork a predefined evaluator.

Manage rules

Use rule endpoints to attach evaluators to matching generation or conversation traffic.

MethodPathDescription
GET/api/v1/eval/rulesList all evaluation rules.
POST/api/v1/eval/rulesCreate a rule.
GET/api/v1/eval/rules/{id}Get a rule by ID.
PATCH/api/v1/eval/rules/{id}Update a rule.
DELETE/api/v1/eval/rules/{id}Delete a rule.
POST/api/v1/eval/rules:previewPreview rule matches.
GET/api/v1/eval/rules/{id}/actionsList rule actions.
POST/api/v1/eval/rules/{id}/actionsCreate a rule action.
GET/api/v1/eval/rules/{id}/actions/{action_id}Get a rule action.
PATCH/api/v1/eval/rules/{id}/actions/{action_id}Update a rule action.
DELETE/api/v1/eval/rules/{id}/actions/{action_id}Delete a rule action.

Discover judge providers

Use judge provider endpoints to discover configured judge providers and models.

MethodPathDescription
GET/api/v1/eval/judge/providersList discovered judge providers.
GET/api/v1/eval/judge/modelsList models for a provider.

Manage templates

Use template endpoints to manage reusable evaluator templates and versions.

MethodPathDescription
GET/api/v1/eval/templatesList evaluator templates.
POST/api/v1/eval/templatesCreate an evaluator template.
GET/api/v1/eval/templates/{id}Get a template by ID.
DELETE/api/v1/eval/templates/{id}Delete a template.
POST/api/v1/eval/templates/{id}:forkFork a template.
GET/api/v1/eval/templates/{id}/versionsList template versions.
POST/api/v1/eval/templates/{id}/versionsPublish a template version.
GET/api/v1/eval/templates/{id}/versions/{version}Get a template version.

Manage guards

Use guard endpoints to evaluate requests synchronously and manage guard rules.

MethodPathDescription
POST/api/v1/hooks:evaluateEvaluate a request against enabled guards.
GET/api/v1/eval/hook-rulesList all guard rules.
POST/api/v1/eval/hook-rulesCreate a guard rule.
GET/api/v1/eval/hook-rules/{id}Get a guard rule by ID.
PUT/api/v1/eval/hook-rules/{id}Update a guard rule.
DELETE/api/v1/eval/hook-rules/{id}Delete a guard rule.

Hook evaluation request

JSON
{
  "phase": "preflight",
  "context": {
    "agent_name": "my-agent",
    "model": { "provider": "openai", "name": "gpt-4o" },
    "tags": { "env": "production" }
  },
  "input": {
    "messages": [
      { "role": "user", "parts": [{ "kind": "text", "text": "Hello" }] }
    ],
    "system_prompt": "You are a helpful assistant.",
    "tools": []
  }
}

Hook evaluation response

JSON
{
  "action": "allow",
  "transformed_input": null,
  "evaluations": []
}

The action field is allow or deny. When any guard rule applied redactions, transformed_input contains the sanitized copy of the input. Each entry in evaluations reports a per-rule outcome with rule_id, evaluator_id, passed, and latency_ms.

Guard rule configuration

JSON
{
  "rule_id": "block_tools",
  "enabled": true,
  "phase": "preflight",
  "priority": 5,
  "selector": "all",
  "match": {},
  "evaluator_ids": [],
  "action_on_fail": "deny",
  "tool_filter": { "blocked_names": ["shell_exec", "danger_*"] },
  "redact": {
    "patterns": [
      { "id": "ssn", "regex": "\\b\\d{3}-\\d{2}-\\d{4}\\b" }
    ]
  }
}

Each guard rule must include at least one of these fields: evaluator_ids, redact.patterns, or tool_filter.blocked_names. Redaction matches are always replaced with the fixed token redact; free-form replacement text is not accepted.

Export scores

Use score ingest to export externally computed scores from SDKs, CI jobs, and benchmark processes.

TransportEndpoint
HTTPPOST /api/v1/scores:export

Scores are idempotent by score_id. Resubmitting the same score ID returns a duplicate item result instead of creating another score. A score must include either generation_id or trial_id. Scores with experiment_id are rejected if the experiment doesn’t exist for the authenticated tenant.

Manage saved conversations

Use saved conversation endpoints to bookmark telemetry conversations or create manual conversations for review and experiments.

MethodPathDescription
GET/api/v1/eval/saved-conversationsList saved conversations.
POST/api/v1/eval/saved-conversationsSave a telemetry conversation.
POST/api/v1/eval/saved-conversations:manualCreate a manual conversation.
GET/api/v1/eval/saved-conversations/{id}Get a saved conversation.
DELETE/api/v1/eval/saved-conversations/{id}Delete a saved conversation.
GET/api/v1/eval/saved-conversations/{id}/collectionsList collections containing a saved conversation.

Manage collections

Use collection endpoints to group saved conversations for review or promotion into test cases.

MethodPathDescription
GET/api/v1/eval/collectionsList collections.
POST/api/v1/eval/collectionsCreate a collection.
GET/api/v1/eval/collections/{id}Get a collection.
PATCH/api/v1/eval/collections/{id}Update a collection.
DELETE/api/v1/eval/collections/{id}Delete a collection.
GET/api/v1/eval/collections/{id}/membersList collection members.
POST/api/v1/eval/collections/{id}/membersAdd collection members.
DELETE/api/v1/eval/collections/{id}/members/{saved_id}Remove a collection member.

Manage test suites

Use test suite endpoints to manage versioned datasets for repeatable offline experiments. Add or edit cases in a draft, then publish the version to make it a stable input for experiment runs.

MethodPathDescription
GET/api/v1/eval/test-suitesList test suites.
POST/api/v1/eval/test-suitesCreate a test suite.
GET/api/v1/eval/test-suites/{suite_id}Get a test suite and its versions.
PATCH/api/v1/eval/test-suites/{suite_id}Update test suite metadata.
POST/api/v1/eval/test-suites/{suite_id}/versionsCreate a draft version.
GET/api/v1/eval/test-suites/{suite_id}/versions/{version}/test-casesList test cases in a version.
POST/api/v1/eval/test-suites/{suite_id}/versions/{version}/test-casesCreate or update a test case.
GET/api/v1/eval/test-suites/{suite_id}/versions/{version}/test-cases/{test_case_id}Get a test case.
PATCH/api/v1/eval/test-suites/{suite_id}/versions/{version}/test-cases/{test_case_id}Update a test case.
DELETE/api/v1/eval/test-suites/{suite_id}/versions/{version}/test-cases/{test_case_id}Delete a test case.
POST/api/v1/eval/test-suites/{suite_id}/versions/{version}:publishPublish a suite version.

Published versions are immutable. Create a new draft version when you need to change the suite. The Agent Observability SDK exposes these operations through TestSuitesClient and can synchronize local YAML or JSON suites with stored suite versions.

Read experiment results

Use the Agent Observability SDK to read the scores and aggregated report for an offline experiment.

MethodPathDescription
GET/api/v1/eval/experiments/{id}/scoresList experiment scores.
GET/api/v1/eval/experiments/{id}/reportGet the aggregated experiment report.

These reads use the same tenant API credentials as experiment run ingest. In Python, use experiment.report() to retrieve the aggregated report and experiment.client.list_scores() to retrieve scores.

Ingest experiment runs

Use experiment run ingest endpoints from SDKs, CI jobs, and benchmark processes that execute test cases. Prefer the Agent Observability SDK, which manages these calls and finalizes experiments automatically. These endpoints use tenant API credentials.

MethodPathDescription
POST/api/v1/experiment-runs:upsertCreate or resume an experiment.
POST/api/v1/experiment-runs/{experiment_id}:finalizeFinalize an experiment.
POST/api/v1/experiment-runs/{experiment_id}/trialsCreate or update a test-case trial.
PATCH/api/v1/experiment-runs/{experiment_id}/trials/{trial_id}Update a test-case trial.
POST/api/v1/experiment-runs/{experiment_id}/trials/{trial_id}/artifacts:uploadUpload a trial artifact.

After you finalize an experiment, Agent Observability builds its report in the background.

Set planned_trial_count when you create the run if the total number of attempts is known. Agent Observability uses this value to show progress for an active experiment.

Configure evaluator types

LLM judge

JSON
{
  "kind": "llm_judge",
  "config": {
    "provider": "openai",
    "model": "gpt-4o-mini",
    "system_prompt": "You are a quality evaluator.",
    "user_prompt": "Rate this response:\n{{agent_response}}",
    "max_tokens": 100,
    "temperature": 0.0,
    "timeout_ms": 30000
  }
}

JSON schema

JSON
{
  "kind": "json_schema",
  "config": {
    "schema": {
      "type": "object",
      "required": ["answer"],
      "properties": {
        "answer": { "type": "string" }
      }
    },
    "target": "response"
  }
}

The optional target field sets the text to evaluate: response (default), input, or system_prompt.

Regex

JSON
{
  "kind": "regex",
  "config": {
    "pattern": "^\\d+$",
    "reject": false,
    "target": "response"
  }
}

Heuristic

JSON
{
  "kind": "heuristic",
  "config": {
    "version": "v2",
    "target": "response",
    "root": {
      "kind": "group",
      "operator": "and",
      "rules": [
        { "kind": "rule", "type": "not_empty" },
        { "kind": "rule", "type": "min_length", "value": 10 }
      ]
    }
  }
}

Choose rule selectors

SelectorDescription
user_visible_turnAssistant text responses without tool calls.
all_assistant_generationsAny agent output.
tool_call_stepsGenerations containing tool calls.
errored_generationsGenerations with call_error.
conversationFull conversations after the configured idle window.

Integrate rule alerts

Rules can include an alert_rule_uids field that stores the UIDs of Grafana alert rules created for the evaluation. In Agent Observability, add alerts from the evaluation creation or configuration flow by setting a pass-rate threshold and contact point. Alerts are created as non-provisioned, so you can edit them in the Grafana Alerting UI afterward.