WEBVTT

1
00:00:00.000 --> 00:00:04.096
Here is the complete record of an AI agent asked to repair a file.

2
00:00:04.096 --> 00:00:05.151
It read the file.

3
00:00:05.151 --> 00:00:06.268
It wrote the file.

4
00:00:06.268 --> 00:00:09.371
Then it replied: done, and asked for nothing more.

5
00:00:09.717 --> 00:00:11.728
So, is the file repaired?

6
00:00:12.067 --> 00:00:14.143
Nothing in this record can tell us.

7
00:00:14.143 --> 00:00:18.057
By the end of this video, you'll see which observation is missing,

8
00:00:18.057 --> 00:00:21.438
and why an agent saying "done" is a claim, not a verdict.

9
00:00:22.483 --> 00:00:26.494
First, let's separate two things we usually blur together.

10
00:00:26.833 --> 00:00:28.501
A language model produces text.

11
00:00:28.501 --> 00:00:29.524
That's all it does.

12
00:00:29.524 --> 00:00:33.991
Sometimes that text is shaped like a request: call this tool, with these arguments.

13
00:00:33.991 --> 00:00:35.444
We'll call that a proposal.

14
00:00:35.783 --> 00:00:41.315
The program around the model, the controller, decides what happens next.

15
00:00:41.315 --> 00:00:46.463
It checks the call: a tool it knows, the argument names it expects,

16
00:00:46.463 --> 00:00:49.536
a path it allows, and text it can write.

17
00:00:49.536 --> 00:00:52.994
Only then does the proposal become an action.

18
00:00:53.333 --> 00:00:55.955
When a call fails those checks, nothing runs.

19
00:00:55.955 --> 00:00:59.335
The controller sends back a refusal as that call's result,

20
00:00:59.335 --> 00:01:01.607
and the model sees it on its next turn.

21
00:01:01.607 --> 00:01:05.744
The model can ask for anything; the controller decides what is allowed.

22
00:01:06.782 --> 00:01:12.115
Now watch the loop turn by turn, on the smallest task we could think of.

23
00:01:12.115 --> 00:01:15.449
A file, result.txt, contains the number five.

24
00:01:15.449 --> 00:01:17.153
It should contain four.

25
00:01:17.498 --> 00:01:19.807
On turn one, the model calls read.

26
00:01:19.807 --> 00:01:24.083
The controller runs it, and sends back the actual result: five.

27
00:01:24.083 --> 00:01:27.749
Every later request carries it: the file, not a guess.

28
00:01:28.098 --> 00:01:30.538
On turn two, the call is: write four.

29
00:01:30.538 --> 00:01:34.229
The controller writes it, and the tool reports: written.

30
00:01:34.565 --> 00:01:35.647
Should we stop now?

31
00:01:35.647 --> 00:01:36.444
It's tempting.

32
00:01:36.444 --> 00:01:38.038
The file probably says four.

33
00:01:38.038 --> 00:01:40.942
But "written" only tells us a side effect happened.

34
00:01:40.942 --> 00:01:44.016
It doesn't tell us the result meets the specification.

35
00:01:44.365 --> 00:01:46.674
On turn three, the call is: verify.

36
00:01:46.674 --> 00:01:51.094
A fixed check compares the file to the spec, and reports: verified.

37
00:01:51.094 --> 00:01:54.656
That result, under the call's own ID, is the evidence.

38
00:01:54.998 --> 00:02:00.073
On turn four, the model asks for nothing more, so the loop stops with final.

39
00:02:00.073 --> 00:02:03.813
The model proposes, the controller decides, a tool acts,

40
00:02:03.813 --> 00:02:07.152
and the observation goes back for the next choice.

41
00:02:07.152 --> 00:02:09.689
That circle is the core of this agent.

42
00:02:10.732 --> 00:02:13.480
Now rewind, and let the model make a mistake.

43
00:02:13.480 --> 00:02:16.168
On turn two, it writes five instead of four.

44
00:02:16.168 --> 00:02:17.695
The write still succeeds.

45
00:02:17.695 --> 00:02:19.527
The tool still says "written".

46
00:02:19.527 --> 00:02:21.543
Only the check notices: it fails.

47
00:02:21.882 --> 00:02:27.176
Suppose the model now replies with no calls: "Verified." The loop stops with final,

48
00:02:27.176 --> 00:02:28.515
as the contract says.

49
00:02:28.515 --> 00:02:32.534
But that reply cannot change the result under the check's call,

50
00:02:32.534 --> 00:02:35.213
however convincing its explanation sounds.

51
00:02:35.548 --> 00:02:37.872
A message can describe the result.

52
00:02:37.872 --> 00:02:39.718
Only the check observes it.

53
00:02:39.718 --> 00:02:44.639
So report verified only when a passing check comes after the last write.

54
00:02:45.680 --> 00:02:47.172
So how does this loop end?

55
00:02:47.172 --> 00:02:50.731
There are only two stop reasons, and neither one is the check.

56
00:02:51.080 --> 00:02:53.457
Final: a reply had no tool calls.

57
00:02:53.457 --> 00:02:57.345
Step limit: the turn budget, four by default, ran out.

58
00:02:57.345 --> 00:03:01.810
Nothing in the contract detects a repeat, so without a budget,

59
00:03:01.810 --> 00:03:05.411
a model that keeps asking could go around forever.

60
00:03:05.747 --> 00:03:10.449
The check is read separately, from the history: the newest verify result,

61
00:03:10.449 --> 00:03:13.219
or not run, if a later write made it stale.

62
00:03:13.219 --> 00:03:14.636
Here is a run of ours.

63
00:03:14.636 --> 00:03:15.731
The check passed.

64
00:03:15.731 --> 00:03:19.016
Then the model wrote again, and the budget ran out.

65
00:03:19.016 --> 00:03:20.562
Stop reason: step limit.

66
00:03:20.562 --> 00:03:21.528
Check: not run.

67
00:03:21.528 --> 00:03:23.718
The earlier pass no longer counts.

68
00:03:24.063 --> 00:03:27.272
Final means the conversation stopped.

69
00:03:27.272 --> 00:03:29.873
Verified means a check passed.

70
00:03:29.873 --> 00:03:35.337
The two are independent: when we cut the budget to three turns,

71
00:03:35.337 --> 00:03:40.973
the correct run ended at the step limit, with its check verified.

72
00:03:40.973 --> 00:03:43.314
Keep those two words apart.

73
00:03:44.363 --> 00:03:46.208
Now look at the tools.

74
00:03:46.208 --> 00:03:48.473
Each has a narrow contract.

75
00:03:48.473 --> 00:03:50.737
Read takes only result.txt.

76
00:03:50.737 --> 00:03:56.020
Write takes at most thirty-two characters, only for result.txt.

77
00:03:56.020 --> 00:03:59.374
Bash runs only the fixed verify command.

78
00:03:59.713 --> 00:04:04.985
Any other tool, argument name, path or command is refused before any effect,

79
00:04:04.985 --> 00:04:08.454
and the refusal goes back under the call's own ID.

80
00:04:08.454 --> 00:04:13.934
In our run of the fixture's tool function, each of these six came back refused,

81
00:04:13.934 --> 00:04:16.084
and result.txt still held five.

82
00:04:16.430 --> 00:04:19.067
So the name bash does not grant a shell.

83
00:04:19.067 --> 00:04:21.836
That restriction lives in the tool's code;

84
00:04:21.836 --> 00:04:25.858
a prompt asking the model to be careful would not enforce it.

85
00:04:25.858 --> 00:04:27.704
But know this loop's limits.

86
00:04:27.704 --> 00:04:30.737
The turn budget bounds the number of requests.

87
00:04:30.737 --> 00:04:35.220
It does not prove progress, and it is not a secure process boundary.

88
00:04:35.220 --> 00:04:38.780
So run an agent in a dedicated directory or container,

89
00:04:38.780 --> 00:04:41.681
with no employer or cloud credentials in it.

90
00:04:42.730 --> 00:04:46.489
The same question applies to a real agent's instructions.

91
00:04:46.489 --> 00:04:49.061
Some open-source agents publish theirs.

92
00:04:49.061 --> 00:04:53.941
Read them as text, and sort what you find into four kinds: a role or goal,

93
00:04:53.941 --> 00:04:58.821
a tool contract, a stopping or escalation rule, and a request for caution.

94
00:04:59.163 --> 00:05:01.796
Then ask of each one: what enforces this?

95
00:05:01.796 --> 00:05:03.721
A schema, the tool's own code,

96
00:05:03.721 --> 00:05:07.766
or a permission check or sandbox outside the model can enforce.

97
00:05:07.766 --> 00:05:10.398
A sentence that begins "never" only asks.

98
00:05:10.398 --> 00:05:15.213
Our loop makes the same split: the tool's checks before any effect enforce,

99
00:05:15.213 --> 00:05:18.294
while the contract text in the prompt only asks.

100
00:05:18.630 --> 00:05:20.146
Two habits carry over.

101
00:05:20.146 --> 00:05:25.866
A system prompt describes the agent's role and workflow; it does not execute tests.

102
00:05:25.866 --> 00:05:31.516
And for every rule, name the component that enforces it, or say that it only asks.

103
00:05:31.516 --> 00:05:35.306
One limit remains: published files describe components.

104
00:05:35.306 --> 00:05:39.441
Only a captured request can show what one run actually sent.

105
00:05:40.480 --> 00:05:41.649
So let's read one.

106
00:05:41.649 --> 00:05:45.091
This is the sample session that comes with the notes.

107
00:05:45.091 --> 00:05:49.898
It was written by hand, in the format a real recording uses: ten requests,

108
00:05:49.898 --> 00:05:52.691
each with what was sent and what came back.

109
00:05:53.030 --> 00:05:57.104
Request four carries five tool definitions and nine messages:

110
00:05:57.104 --> 00:06:02.513
the system instructions, the user's task, and every earlier call with its result.

111
00:06:02.513 --> 00:06:04.249
The reply holds two calls.

112
00:06:04.249 --> 00:06:06.921
One of them, call six, proposes an edit.

113
00:06:07.263 --> 00:06:12.596
Before you open request five, predict: what will that edit return?

114
00:06:12.596 --> 00:06:13.323
Now look.

115
00:06:13.323 --> 00:06:18.656
Under call six's own ID sits an error: the old text was not found,

116
00:06:18.656 --> 00:06:20.514
and no change was made.

117
00:06:20.863 --> 00:06:25.049
Request six shows the retry, and this time one replacement is made.

118
00:06:25.049 --> 00:06:30.046
Then the agent runs the tests, and request seven carries the result: one failed,

119
00:06:30.046 --> 00:06:30.733
one passed.

120
00:06:30.733 --> 00:06:34.794
Every result is filed under the ID of the call that asked for it.

121
00:06:35.828 --> 00:06:38.648
Now label what you say about this record.

122
00:06:38.648 --> 00:06:42.775
Observed means the record holds it, at a place you can cite.

123
00:06:42.775 --> 00:06:45.870
Request five, message eleven: the error text.

124
00:06:45.870 --> 00:06:47.039
That is observed.

125
00:06:47.378 --> 00:06:52.045
Inferred means you are explaining why it happened, or what comes next.

126
00:06:52.045 --> 00:06:57.444
The model copied a line number out of the file it had read: that is an inference.

127
00:06:57.444 --> 00:07:01.177
The record does hold the agent's own sentence saying so.

128
00:07:01.177 --> 00:07:03.576
That the agent wrote it is observed.

129
00:07:03.576 --> 00:07:06.509
That it is the true cause is still inferred.

130
00:07:06.845 --> 00:07:09.649
Last, find the check behind the final reply.

131
00:07:09.649 --> 00:07:11.752
The final reply says: two passed.

132
00:07:11.752 --> 00:07:13.345
That sentence is a claim.

133
00:07:13.345 --> 00:07:18.633
The observation is in request nine, message twenty-one: exit code zero, two passed.

134
00:07:18.633 --> 00:07:20.736
And it comes after the last edit.

135
00:07:21.078 --> 00:07:23.167
And say what a record cannot show.

136
00:07:23.167 --> 00:07:28.325
This one was written by hand, so it tells you nothing about what a real agent sends.

137
00:07:28.325 --> 00:07:31.150
Your own capture may hide the system messages.

138
00:07:31.150 --> 00:07:35.449
Write that limit down, and never fill the gap from a published prompt.

139
00:07:36.495 --> 00:07:40.306
So, back to where we started: read, write, done.

140
00:07:40.645 --> 00:07:45.459
The missing observation was a passing check after the last write.

141
00:07:45.459 --> 00:07:47.903
With it, you may report verified.

142
00:07:47.903 --> 00:07:50.496
Without it, "done" is just a claim.

143
00:07:50.845 --> 00:07:56.897
This week's assignment ends with one line: accept, narrow, re-check or stop,

144
00:07:56.897 --> 00:07:58.808
and the evidence for it.

145
00:07:58.808 --> 00:08:00.162
So try that here.

146
00:08:00.162 --> 00:08:04.860
A record ends with a write, then "done", and no more calls.

147
00:08:04.860 --> 00:08:07.011
Which claim is unsupported?

148
00:08:07.011 --> 00:08:11.072
Which command would supply the missing observation?

149
00:08:11.072 --> 00:08:14.576
And which of the four words would you write?
