Session 6 — Planning and decisions
Goals
- Distinguish between a plan written in advance and a decision after every observation.
- Phrase a stop condition before the loop runs.
- See when splitting into two roles adds information, and when it only doubles the work.
Two forms
In a fixed workflow the order of steps is known. It is cheap and easy to explain, and blind after the first step if the observation contradicts an assumption.
In an adaptive agent every observation can change the next action. It pays for this with more calls, and the decision can be read if it is written to a log.
Two ways to plan
Interleaved (ReAct): a short thought, an action, an observation, and around again. Each step is set after seeing the result of the previous one. It fits when you cannot know in advance what retrieval will return.
Plan, then execute: first a list of steps, then execution in order. The plan is easy to check before anything runs, and it can be approved. The price: if step 2 returns something unexpected, you need a rule that decides when to write a new plan.
In both, someone has to check that the task was completed. A plan carried out to the end is not proof that the answer is right.
Stop condition and budget
A stop condition should be one of these, explicitly: enough evidence was found, the available evidence is not enough, or a budget or a tool ran out. Do not mix the third with the second.
Before the loop runs, write three things: what counts as success, how many steps or calls are allowed, and what is returned when the budget runs out. Lab 3 tests such a case: with only one source, the status is "need another retrieval", not an answer.
Division of work
Two agents are justified when each has a different window, tools or sources, and when there is a rule for contradictions. The same task for both, without a boundary, produces duplication. Session 11 tests this in code. Here it is enough to sketch who sends to whom, what must not overlap, and who signs off on the answer.
In the demo above, both policies answer the same question about QuickScreen. Write a three-step plan for the fixed workflow. Mark the step where the observation should have changed the plan, and write the rule that would have detected it. Does that rule turn the workflow into an agent?
Check your understanding
Reading
Yao et al., ReAct: Synergizing Reasoning and Acting in Language Models, ICLR 2023. arXiv:2210.03629. The abstract and figure 1.
Summary
Found a mistake on this page? Email the lecturer