Engineering · AI · Video

How Our AI Agent Grades Its Own Lesson Videos Before They Post

15 min read

How we draw educational videos in code, and the gates, the critic and the queue that keep them worth watching.

Update, November 22. A week after this post, Cereby stopped making drawn lessons. A lesson is now a narrator over a 3D scene written for that lesson, and the checks pose that scene before it is drawn and stop a take for anything a viewer would see is wrong. The critic, the holds and the improvement queue described below still run on every lesson. What changed, and how we cut the bill for drawing a lesson to a few cents, is in How Cereby's Lesson Videos Moved to 3D Scenes in One Week.

A lesson about the Bermuda Triangle needs a map. Ours had one: an ocean, three points, a triangle drawn between them. It had no land. No Florida, no Bermuda, no Puerto Rico. Three dots floating in blue.

The lesson was graded before anyone posted it, by the same agent that made it. Its critique gave the pictures four of five. One sentence in that critique explained how: "I could not open the contact sheet from here, so these scores lean on the reports." The critic had never seen the video. It had read a description of the map, found a map in it, and scored the map.

This post is about the drawn lesson, the 45 to 75 second educational video that is now the main thing Cereby posts, and the system that decides whether one is good enough to go out. It is one of two posts about the agent that runs our marketing. The other, about the server that agent works through, is Giving Our AI Agent Read-Only Access to Production, Behind Four Locks.

It is early, and the numbers here are small. The critic graded its first lesson four days before this post. Since then it has written 196 critiques of 161 lessons. Everything below comes from those four days.

The lessons themselves are public. To see the kind of video this post is about, watch a few on YouTube.

Why we draw them in code

A lesson is five to ten shots: a hook, the facts, a quick check, and a short invitation to try the app. Cereby, our mascot, teaches it to a student. Both are drawings.

We started with a video model, and it gave us a problem we could not prompt our way out of. Every rule that kept Cereby looking like Cereby (one of it, facing the camera, no legs, no garbled writing on screen) also kept the clip from moving. A lesson about a stack that never stacks is a talking head.

So the picture is now drawn in code, frame by frame, and only the voices come from a speech model. The agent writes a shot as data: who is on screen, where, and a list of beats, each one a thing that happens on a word. "On 'stack', the third block drops onto the pile." The renderer measures the voice track to find when each word is said, and the beat lands there. A shot takes about two seconds to draw per second of video, on one CPU, and a whole lesson costs a few cents.

That last number changes what is sensible. When a video costs cents, nobody needs to approve a storyboard. The risk moves from "this is expensive" to "this is cheap enough to make a hundred bad ones".

A hundred bad ones

On November 9 we audited what the agent had made: 172 critiques across 138 lessons, plus the first watch-time numbers from real posts.

The lessons moved, but not the way the idea moved. Across one day's 52 lessons there were 591 beats that stress a word (a pulse, a glow, a shake, a wiggle) and 169 beats where one thing does something to another. A clock hand that should have moved shook instead. Lessons ran 65 to 113 seconds and held up to seven ideas. And the two lessons that had retention numbers kept 16% and 25% of viewers past three seconds. The critic had scored both of their hooks four of five.

The breathing lesson is the one we kept coming back to. Its line said air goes into the lungs. Every check passed. In the picture, the air sat beside the lungs:

Every check read what was written: the actors, the beats, the layout as numbers. None of them read what was drawn.

The shape we landed on

There are now three layers, and each one is stricter about evidence than the one before it. Gates refuse a lesson before it is drawn. A critic grades it after, from the finished file. And a queue turns what the critic could not fix itself into code:

The rest of this post is the parts of that diagram that were wrong the first time.

Emphasis is not the idea

We ship a library of ready-made shot layouts, called templates: a stack, a cycle, a comparison, a zoom. There were 36 when we wrote this rule, and they fit most ideas well enough. That was the trouble. The agent reached for one even where it showed a third of what the line was about.

Asking it to stop did not work. Prompting does not move an agent off the easy path, so the renderer enforces it. Every teaching shot now has to say the one picture its line needs, and, if it uses a template, how much of that picture the template shows, from 0 to 100. Under 70, the render is refused and the agent composes the shot by hand. At least two teaching shots in every lesson must be composed for that lesson. And a composed shot is refused if more of its beats stress words than make something happen.

The same gate checks where the lesson goes. A lesson starts in a classroom, and at least one shot has to travel to where the idea lives: inside a cell, a courtroom, a server room. The trip has to be shown, too. A grapefruit lesson went from the classroom straight to the wall of the intestine, with nothing between. A shot set inside something now has to follow a shot that is already inside, or one that ends by taking the viewer in: a dive into the thing, or a magnifying glass over it.

Nothing saw the picture

The breathing lesson passed every written check, so we added one that looks. At the dry run, a vision model is shown three frames of each drawn shot beside the words being said at each, and asked one thing: does a viewer see what the line says?

The check that could not refuse. The first version only left notes. That same night a lungs lesson went through with its air drawn as four circles, each as big as a lobe. A check that cannot block is a comment. Now three findings refuse the render: a picture that does not show its line, a thing outside what it belongs in, and a thing so large it hides what the shot is about. A model that looks at pictures is sometimes wrong, so the agent can overrule it for a shot it has looked at itself, by number. And where nobody is there to overrule it, in the unattended campaign writer, the check does not run.

Framing needed rules of its own. A camera pushed in on a liver cell while the teacher named an enzyme that sat half off the right edge, its label cut short to CYP3. Whatever a line is naming now stays whole in frame while it is named, and the camera move is adjusted to keep it there. And nothing may slide behind Cereby when the camera zooms.

A critic that cannot see

Which brings back the map. The review handed the critic its frames as a link to a stored image. The critic runs somewhere that cannot open that link. It said so, in the sentence quoted at the top, and then scored anyway, because nothing stopped it.

The frames now come back inside the review itself, as pictures, a row of four at a time, each large enough to tell land from sea and to read a label. If they cannot be read, the review says the frames were not seen, the critique has to record that it did not watch, and a critique that did not watch holds the video. The frames are cut from the rendered file, not redrawn from the lesson's data, so a bug in the renderer shows up in them too.

The fix for the map itself was ordinary: real coastlines as data on the server, and shots placed by latitude and longitude.

Facts, not impressions

A critic that sees the video is still guessing unless it is given facts. So the review computes them. An asset report compares what the lines name with what was drawn, and says which drawings moved and which sat still. A gap in it is a statement about the library, not a feeling about a frame: this drawing exists and has no such move.

The same goes for sound. The review transcribes the finished video's own audio, word by word, and lines it up against the script and the beats. It lists the words the voice skipped or added, and the things that came on screen well after they were named. The critic reads what was said beside what was on screen at that second. The audio got two rules of its own along the way: a sound effect may play three times a lesson at most, and labels cannot name a thing in words the voice never says.

Then it scores. The rubric has 19 scores from 1 to 5: accuracy, whether the pictures are the idea, the hook, the camera, the faces, the sound, down to the caption. Any score of 1, or any issue marked blocking, holds the video. Of 196 critiques, 11 held one.

One rocket, one request

A critique also lists issues, and every issue has a type. There are 36 types, and they split into two kinds. Some are the lesson's own to fix: the wrong template, a flat line reading, a camera that sat still. The others need code that does not exist yet: a drawing the library lacks, a move a drawing cannot make, a renderer bug.

The second kind becomes work. Each one is filed as an improvement request with a brief a coding agent can act on alone. Requests are deduplicated by what they are about, not by which lesson complained: the same missing drawing from three lessons is one request with three lessons on it. The 387 code issues became 270 requests. Seventy of those carry more than one lesson, and the busiest carries six.

A coding agent takes one request, opens one small change, and a human merges it. Then the part that matters: a request is not done when the code merges. It is done when a lesson that had the problem is rendered again, reviewed again and critiqued again, and that new critique no longer reports it. The request records which critique cleared it.

Here is where the queue stands, and it is not flattering:

The critic files faster than we fix: 218 of 270 are still open. Forty have merged, and 16 of those have been verified by a second critique. We would rather publish that than a loop diagram with no numbers on it.

The loop also grew what the agent reads. Every new template, drawing and scene it produced was also a few more lines the agent had to read before doing anything. Catalogs are now looked up on demand and never listed up front, and a test fails any change that lists one.

Scored four, held 16 percent

The hook was the one score we could check against the world. The critic had been judging the first two seconds by feel, and the audit showed what feel was worth.

Posts already report how many viewers stay past the opening and where they leave. So a posted lesson's review now carries those numbers, and every review carries a calibration: how the critic's past hook scores lined up with what held. A hook it scored five that lost most of its viewers is a lesson about its own judgment. The rules got firmer too. A lesson past 75 seconds is told to cut. The hook has to have gone somewhere by second eight.

We cannot say yet whether this moved retention. Two lessons had numbers when we audited. That is a reason to build the calibration, not a result.

Before and after

BeforeNow
What the checks readThe shot as writtenThe shot as written, three frames of it, and its audio as heard
A template that half fitsUsedRefused under 70 of 100
The critic's evidenceA link it could not openFrames in the review, or the video is held
A missing drawingA note in one critiqueOne request, verified by a later critique
The hook scoreBy feelBeside the share that stayed
Something new a lesson can showUngraded until someone noticedA test fails until the critic has issue types that judge it

What this taught us

A grader that reads descriptions grades descriptions. The map had a triangle and three named points in its data, and that was enough for four of five. The fix was not a better rubric. It was making "I did not see it" hold the video.

Prompting did not change what the agent reached for, and refusing did. The fit gate, the motion rule and the picture check all began as advice, and each one started working the day it could say no.

Cheap output needs expensive evidence. When a lesson cost real money, a person looked at every one. At a few cents, the looking has to be built, and it has to look at the finished file.

A loop is only closed where it is verified. Forty merged changes are forty claims. Sixteen of them have a critique attached that says the problem is gone.

What's next

The queue is the honest backlog: 218 requests open, and 100 of the 270 filed are renderer bugs. The calibration needs more than two posted lessons before the hook score means anything. And the picture check does not run when a campaign is written unattended, which is exactly when nobody is watching.

All engineering posts