Skip to content
Context docs
Build

Read a run's results over HTTP

This example finds an evaluation’s latest run, reads each cell’s average score and pages through each task’s result.

What a run, its cells and its scores mean is explained once, in Read results. This page pulls them into your own tools.

Before you start

  • CONTEXT_APP_ORIGIN and a read-only CONTEXT_API_KEY, set as in the quickstart.
  • The ID of a benchmark that has run (the API’s paths call a benchmark’s ID evaluationId). List evaluations returns them (send workspaceScope as in the quickstart), or use context evals benchmark list, whose rows carry runCount.

Steps

TerminalCode
export EVALUATION_ID="<evaluation-id>"
  1. Find the latest run

    List an evaluation’s runs returns them newest first; the examples sort by createdAt so the order doesn’t depend on that. A run’s status ends as COMPLETED, FAILED or STOPPED; scores are final only once it has ended.

    curl -sS --fail-with-body "$CONTEXT_APP_ORIGIN/api/v1/evals/benchmarks/$EVALUATION_ID/runs" \ -H "Authorization: Bearer $CONTEXT_API_KEY" | jq -r 'sort_by(.createdAt) | reverse | .[] | [.id, .status, .createdAt] | @tsv'
    TerminalCode
    export RUN_ID="<run-id>"
  2. Read each cell’s score

    Get a run’s status returns the run, with its cells, and a stats entry per cell. Join the two on cellId to see which model or agent each score belongs to. avgScore is from 0 to 1, and null until something has been graded.

    curl -sS --fail-with-body "$CONTEXT_APP_ORIGIN/api/v1/evals/runs/$RUN_ID/status" \ -H "Authorization: Bearer $CONTEXT_API_KEY" | jq '.run.cells as $cells | .stats[] | . as $s | {cellId, value: ($cells[] | select(.cellId == $s.cellId) | .value), avgScore, succeeded, failed}'
    TerminalCode
    export CELL_ID="<cell-id>"
  3. Page through each task’s result

    List a run’s task results takes a cellId and returns up to 50 tasks a page. Each row has the task’s score, its output preview, outputStatus (whether a recorded answer is available), costUsd, latencyMs, and the outcomes of its first 8 criteria under criteria.entries; criteria.totalCount says how many it has. Pass nextCursor back as cursor until it is null.

    curl -sS --fail-with-body --get "$CONTEXT_APP_ORIGIN/api/v1/evals/runs/$RUN_ID/tasks" \ -H "Authorization: Bearer $CONTEXT_API_KEY" \ --data-urlencode "cellId=$CELL_ID" \ --data-urlencode 'limit=50' | jq -r '.rows[] | [.taskId, .score, .outputStatus] | @tsv'

    Get one task’s result, with the same cellId, returns one task’s full answer and every criterion’s outcome with its reasoning.