Back to the live demo

McKinsey x QuantumBlack AI Hackathon, Doha, 18 to 19 September 2026. 2nd of 9 teams.

Clarity AI

An agentic marking assistant for community teachers. It marks a test, finds out why each student lost marks, and decides what the teacher should do next, while the teacher keeps the final say.

The brief

The hackathon framed every team as a McKinsey client service team. Our client, from the education theme, was a community learning foundation teaching around 60,000 learners a year, mostly through community facilitators rather than specialist teachers. Many learners study in a second language, and many leave and come back.

A marks sheet shows who scored what. It never shows why each mark was lost, whether it is the same mistake as last month, or whether half the class shares it, which would make it a teaching gap rather than a problem with individual students. And marking eats facilitator time, so feedback arrives too late to change anything.

The brief was explicit that this wasn't a chatbot competition. It wanted agents that reason, decide, act, and pull in a human when they shouldn't act alone.

Clarity AI's home page after analysing a test: one whole-class problem, adds numerators and denominators separately, 5 of 12 students, with a suggested activity, a score histogram and four headline numbers.
After an analysis: the whole-class problem first, with something to try on Monday.

Six agents, one of them a gate

In the appIn the codeWhat it decides
Reading the classintakeLoads the test, the marking scheme, the answers and each student's earlier results from the LMS.
MarkingmarkerDraft marks with a confidence for every criterion. Never a final mark.
Finding mistakesdiagnosticianNames the mistake pattern behind each lost mark out of 24 known ones, quotes the evidence, and gives a runner-up.
Class picturecohort_analystDecides whether a mistake is one student's or the whole class's: 40 percent or more.
PlanningplannerProposes and ranks what to do next: re-teach, catch-ups, restart points, pairings, notes.
Safety checkreviewerHands the teacher low confidence, two close readings, wording problems and thin records.

The graph itself is five nodes and six edges. The safety check isn't a node: it's a gate function that runs at the end of marking, diagnosis and planning, and inside the class analysis. It pulls uncertain items out of what flows downstream and queues them for the teacher, along with what the system would have chosen. Drawing it as a sixth node would imply an edge that doesn't exist, so the diagram doesn't, and a test parses the diagram and fails if it ever disagrees with the compiled graph.

One branch is conditional. If the class analysis has fewer than two findings to work with, the run ends there with insights only, instead of producing a confident-looking plan from two data points.

Agent workflow diagram: inputs on the left, a LangGraph orchestrator over five agents with an enough-signal branch, a safety check gate below them, and teacher-facing outputs on the right with a re-plan loop back into the graph.
The workflow, from the repo.

Where the model isn't allowed to decide

Most of the design is about drawing that line in code rather than asking nicely in a prompt.

  • Marks are always drafts. Every mark the agent produces is provisional until a human approves it.
  • Evidence must be real. Every diagnosis points at an exact piece of the student's answer. If the model quotes text that isn't in the answer, the diagnosis is rejected.
  • Language is never mistaken for maths. If the marking scheme's target value appears in the answer, a maths diagnosis is overruled whatever the model says. That rule was added after the model labelled a correct answer as a procedural mistake at 90 percent confidence.
  • The plan's trade-offs are visible. The model proposes and scores actions, but the plan is filled in code, and anything left out is recorded with a reason, instead of the agent quietly trimming until it fits.
The Needs your call page: three answers held back because the working is right and the wording is the problem, each showing what the student wrote, the competing readings, and what the system would have chosen.
Needs your call. Right working, awkward wording, so it goes to the teacher instead of being counted as a maths gap.

One correction changes the plan

In the demo class, 5 of 12 students add numerators and denominators separately. That's 42 percent, over the whole-class line, so the plan leads with a group re-teach. When the teacher corrects one of those five findings, the graph re-enters at the class analysis, not at the start. The answers haven't changed, so re-marking would only burn time and risk a different result. The count drops to 4 of 12, 33 percent, the group re-teach is withdrawn, and every change to the plan is marked. That's the interaction the homepage replay lets you try.

Measured, not claimed

The mistakes in the test data are injected by Python rules, never by a model. If the same model wrote the errors and then diagnosed them, the score would be self-graded. The backend is blocked from reading the answer key, and the evaluation greps the code and fails if it ever does.

Mid-term, 12 learners, 96 answersResult
Correct mistake pattern named92%23 of 25, and 96% before the safety check held some back
Correct pattern in the top two96%
Evidence quoted from the student's own answer100%31 of 31
Second-language learners wrongly called weak at maths0
Returning learners given a restart point100%3 of 3
Escalation precision66.7%Cautious on purpose: most of what it held back would not have been wrong

Fast, and impossible to crash

  • From 190 seconds to about 20. Marking a class, diagnosing every error and drafting every note are independent calls, so they fan out across a thread pool, and the planner's proposal overlaps its note drafting.
  • A live trace. The graph runs on a worker thread, so the UI would otherwise see nothing until the end. Every event is published as it happens, because a ten-second model step with no output looks exactly like a hang.
  • A circuit breaker. Three failures in a row and every agent switches to deterministic rules. A run against a dead endpoint still completes in 1.5 seconds with full results, and the trace says so.
  • A model chosen by measurement. On the gateway, gpt-4.1-mini returned a batched marking call in about 7 seconds where gpt-4o-mini took 14, and recovered more mistakes than a larger model did.

What I built

From my commits in the repo:

  • The data layer: the mistake taxonomy, marking schemes, personas and the rule-based error generator
  • All six agents, the LangGraph orchestration, and the correction path that re-plans and diffs the plan
  • The first version of the frontend views: the agent trace, learner, class, plan and review pages
  • The evaluation harness and the first test suite, which surfaced four bugs on the way
  • QuantumBlack gateway support, parallel model calls, the live trace, and the circuit breaker

On this page

Pages

Write-ups

Actions

Elsewhere

amanmohammed.xyz↑↓ move↵ select