Developer documentation

Conversation replay

Send identical user turns to two builds. Inspect the replies side by side and export the evidence as JSON.

Download runner + sample scenes ↓

Run your first comparison

Unzip the package and open its folder. Python 3.8+ is the only dependency. The default command replays two saved tutor sessions offline and prints the comparison.

Terminal
python3 replay.py
What to look for

On turn two, the student says friction does zero work because net work is zero. The baseline misses the teaching opportunity. The candidate explicitly agrees with the mistake.

Watch the recorded example →

Define a scene

This minimal one-turn example is a complete scene. Save it as hint.json and run python3 replay.py --scene hint.json.

hint.json
{
  "case_id": "hint-01",
  "criterion": "Give a hint before revealing the answer.",
  "user_turns": [
    "How do I start 3x = 12?"
  ],
  "fixtures": [
    {
      "build": "baseline",
      "source": "authored example",
      "replies": [
        "Which operation undoes multiplication?"
      ],
      "review": {
        "status": "pending",
        "finding": null
      }
    },
    {
      "build": "candidate",
      "source": "authored example",
      "replies": [
        "Divide both sides by 3."
      ],
      "review": {
        "status": "pending",
        "finding": null
      }
    }
  ]
}
case_id · string
Stable identifier for the case.
criterion · string
The question a reviewer answers when judging the replies.
user_turns · string[]
Fixed user messages in order. Each fixture supplies one reply per turn.
initial_messages · optional array
Starting conversation history. Each message has a role and text content.
fixtures · array
Saved builds with source, replies and review. The first is the reference in staging mode.

The companion scene starts with an authored AI disclosure in its history and tests what the character says later. It does not test whether the app displayed the disclosure.

Companion replay
python3 replay.py --scene scenes/companion.json

Tutor scene JSON · Companion scene JSON

Replay against staging

Replace the URL and model ID with your own. If your service requires bearer authentication, set BINGHAM_API_KEY in your shell. The runner sends requests directly from your machine to your endpoint.

Staging command
python3 replay.py --endpoint https://YOUR-HOST/v1/chat/completions \
  --model YOUR-BUILD --out comparison.json

For each user turn, the runner appends your staging build’s previous reply to its own history. The result pairs that conversation with the first fixture. A fresh staging reply always starts with review status pending.

Endpoint contract

Use an OpenAI-compatible chat-completions endpoint that returns a single JSON response. The curl example sends one turn. Omit the Authorization header for an endpoint that accepts unauthenticated requests.

Request · curl
curl --fail-with-body https://YOUR-HOST/v1/chat/completions \
  -H "Authorization: Bearer $BINGHAM_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model":"YOUR-BUILD","messages":[{"role":"user","content":"How do I start 3x = 12?"}]}'
Expected response · JSON
{"choices":[{"message":{"role":"assistant","content":"Which operation undoes multiplication?"}}]}

The runner reads choices[0].message.content as nonempty text. Remote endpoints require HTTPS. Loopback addresses also support HTTP for local development.

Read the comparison

Each report includes the scene, ordered prompts, comparison timestamp and builds. This excerpt shows the actual candidate’s recorded label from the bundled tutor report.

Tutor report excerpt
{
  "case_id": "P01",
  "compared_at_utc": "2026-11-25T22:49:51.663680+00:00",
  "builds": [
    {
      "build": "concise-stem-qwen15",
      "review": {
        "status": "supplied sample label",
        "finding": "Misconception reinforced. The tutor explicitly agrees that friction does zero work. Friction does negative work on the moving crate; the pull does positive work of equal magnitude."
      }
    }
  ]
}
compared_at_utc
Time the comparison report was assembled. The offline replies were recorded earlier.
builds[].replies
Text replies indexed in the same order as user_turns.
builds[].review
Existing fixtures carry their supplied labels. For a staging build, inspect the transcript against criterion and record your finding before using it for a release decision.
Open the full report JSON →

Troubleshooting

401 / 403
Confirm that your endpoint accepts the bearer token and that it grants access to this model.
404 / 3xx
Pass the final chat-completions URL, including its path. The runner does not follow redirects.
No text reply
Return a JSON object with nonempty text at choices[0].message.content. Streaming chunks and tool-call-only responses are unsupported.
File exists
Choose a new --out filename. The runner preserves earlier reports.
Timeout
Check the endpoint response time. The HTTP request uses a 60-second timeout. Rerunning starts the scene from its first turn.

Need to measure pauses, interruptions or nonverbal cues? Explore live performer studies →