Most agents today are still the first kind. Even a coding agent that can work for hours lives in turns: the user hands it a task, it works on it, reports back, and stops to wait for the next message. It has no idea what happened in the world between two turns, and even within a turn it only looks at the world at the moment a tool returns its result. In Welcome to the Era of Experience1, Silver and Sutton describe this as living in short snippets of interaction, and argue that a powerful agent should have its own stream of experience that runs over a long time, as a person's does. I agree.
So what does such an agent need? What I ask of it is simple. First, it keeps moving, without someone nudging it at every step. Second, it reacts at once when it has to, without waiting to finish a thought. Third, it learns new reactions from what it lives through, and gets more fluent the longer it lives. Fourth, it writes these reactions itself, instead of me writing them for it one by one. And I am a little greedy as well: I want all of this to rest directly on the large models we have today, with no extra training.
This post argues that a natural way to get there is to give the agent a behavior tree that keeps growing. It is also where The Harness started.
01Behavior trees may be the best harness for an agent
The world does not wait
Picture an agent at home. It has a body that can walk, and right now it is carrying a cup of water across the living room to put it on the table.
Controlled the way most agents are today, it goes roughly like this: the model looks around, thinks, decides to take two steps forward; the body does it; the model looks again and thinks again. The trouble is that each round of thinking takes seconds, and the world does not stop for those seconds. A ball rolls across the floor, someone calls its name from behind, the water sloshes up to the rim of the cup. Any of these can happen in exactly the seconds the model is thinking. When they do, either something else handles them, or nothing does.
A faster model does not fix this at the root. People do not react quickly because they think quickly either. Most of our reactions never pass through thought at all: the hand pulls back from something hot, and only then do we feel the heat. An agent needs the same kind of thing: something that runs all the time, watches the body and what is going on around it, and can act before the model has made up its mind. I think a behavior tree is the right thing for that job.
A behavior tree
Behavior trees came from the games industry, where they were used to organize the behavior of non-player characters. Around 2005 the AI of Halo 2 began arranging its enemies' behaviors in a tree2, and behavior trees gradually became the standard way to build game AI. Robotics adopted them later; Nav2, the navigation framework of ROS 2, is orchestrated with one3. There are only a few rules, so let us go straight to the cup of water.
Carrying the water is a series of steps in order: walk to the table, bend down, put the cup down. A behavior tree calls this a sequence node: its children run from left to right, each one only after the one before it succeeds, and if any child fails, the whole sequence fails.
But the way is not always clear. So for walking to the table we use a selector node: each of its children carries a condition, the conditions are checked from left to right, and the first child whose condition holds gets control. Say the first child's condition is "something is in the way" and what it does is go round; the second child has no condition and walks straight. With nothing on the floor, the agent walks straight. The moment the ball rolls in front of it, the first child's condition holds and it takes over the body; once the agent is past the ball, the condition no longer holds and control goes back to walking straight.
The last key idea is the tick. A behavior tree is not judged once at the start. It is judged again and again: whenever something it reads changes, or when its time comes round, it is walked again from the root. That is why the further left a branch sits, the higher its priority: as soon as its condition holds, it can cut into any branch to its right that is running. If we put "the cup is tilting" at the far left, then whatever the agent is doing, the moment the cup tilts it steadies the cup first.
Why a behavior tree
There are many ways to control an agent: finite state machines, rule tables, reactive systems stacked in layers, and today's most common one, the conversation loop. I think a behavior tree fits best, for four reasons.
First, it is reactive by nature. The tree is ticked all the time, so the moment the world changes it judges again, with no need to wait for the model. In the 1980s Rodney Brooks controlled robots at MIT with layers of reactive behaviors stacked one on another4: the lower layers always running, the upper ones able to suppress them. From this he argued that intelligence does not first need a complete model of the world built inside, because the world is its own best model5. A behavior tree carries on this reactive line of thought, and is easier to organize and extend than Brooks's layers.
Second, order is priority. Where a node sits decides whom it can interrupt and who can interrupt it. There is no need to give every rule a priority score and then carefully keep the scores consistent with one another; the urgent things go on the left.
Third, it is modular. Every node deals with the rest of the tree through just two things: its parent tells it to run, and it reports back success, failure, or still running. So a subtree can be used in many places, and fixing it once fixes it everywhere. Biggar and colleagues6 have even shown that, across a broad class of reactive control architectures, behavior trees are the most modular. A finite state machine, by contrast, has to consider every new state's transitions to and from all the others, and becomes hard to maintain as it grows.
Fourth, it is just code. A behavior tree fits in a few dozen lines of a program that people can read and large models can write. I think this is the most important of the four, because it means the tree need not be written by people: the agent can write and change it itself. That is what the second part of this post is about.
The reflex tree and the model
With such a tree in place, what is left for the model?
It is easy to see that what an agent does falls into two kinds. One kind is what happens to it: someone calls, it turns round; the water is about to spill, it steadies the cup; the battery runs low, it goes to recharge. The other kind is what it sets out to do: pour a guest a glass of water, tidy the room, learn to cook a dish. The way to tell them apart is to look at how a thing begins. In the first kind the world moves first and the agent answers; in the second the agent has an idea first and then changes the world.
We call the behavior tree that handles the first kind the reflex tree; the model handles the second. The first kind mostly has to be quick and keeps coming back in the same shape, which suits a reflex tree that is always running. The second is usually new and calls for understanding, planning and judgement, which is what large models are good at. Once the model has worked something out, it writes a program and hands it to the body to run. While it runs, the reflex tree keeps running too; whenever something happens it can interrupt the program, and when it has dealt with that it hands control back.
Of course, no reflex tree can foresee everything. When something happens and no node in the reflex tree knows what to do about it, the reflex tree reports it to the model. For the model this is a notice that something new has come up; for the reflex tree it is a sign that it is not yet complete. As we will see, it is exactly these reports that let the reflex tree keep growing.
02An agent can keep growing its own tree by learning
From thinking to reacting
Back to the agent with the cup of water. Suppose that the first time it carries water, its reflex tree has no node for a tilting cup. So when the cup tilts, the reflex tree finds no branch that can answer and has to report it to the model. The model takes a look, thinks for a few seconds, and has the body slow down and level the cup; not all of the water is lost.
If that were the end of it, the next time the cup tilted the model would have to think for a few seconds again, and this time it might be too late. So once the model has dealt with it, it does one more thing: it writes what it just did as a node in the reflex tree. The node says under what condition (the cup is tilting), what to do (slow down and level the cup), and where it goes (to the left of walking). The next time the cup starts to tilt, the new node takes over the body at once, and the model is not even disturbed.
In other words, learning means moving something from thinking to reacting. Learning to drive is the same: at first, checking the mirror, turning the wheel, braking, every move takes thought, and talking while driving is nearly impossible; once you are fluent, those moves become automatic and your mind is freed, to chat as you drive or to think about dinner. The bigger the agent's reflex tree grows, the quieter its model becomes, and the more of its attention it can give to what it really wants to do.
Writing a node
A node is made of three things: a condition, a response, and a place.
The condition says when the node should come in. A good condition describes something that is happening, such as "the cup is tilting" or "someone is calling me"; a node that only checks whether some reading has crossed a threshold tends to come in when it should not. The condition also has to say when the situation is over, or a node that has taken over will not know when to hand control back. The response is what to do while the condition holds: a short piece of action, or simply telling the model. The place decides whom the node can interrupt and who can interrupt it, as we saw above.
Because a node is code, the model writes it like any other program. But a node that has been written does not necessarily work: its condition may never hold, or its response may finish while the situation goes on. So as soon as a node is in place, the agent sets up that situation and tries it, and watches the node work with its own eyes; a situation it cannot set up is noted as such, to be looked at again the first time the node does its job for real.
Growing as a whole
The reflex tree has to grow, but not any which way. The easiest thing is to add one more rule under the root each time something goes wrong, but such a tree soon turns into a long flat rule table whose rules keep interrupting one another, and nobody can say how they relate.
The good way to grow is to hang each new node under the branch it fits best. "The water is about to spill" belongs under the branch for carrying something, because it only means anything while the agent is carrying something; "the battery is low" and "someone is calling me" can happen whatever the agent is doing, so they hang nearer the root. The shape of the reflex tree then records the agent's understanding of the world: which things happen only in which situations, and which things matter more than others.
Once a node is in the reflex tree, it is ticked and revised along with all the others. Over time the tree grows larger and deeper, and less and less has to be reported to the model. What we end up with is a reflex tree grown from the agent's own life. Its shape differs from one agent to the next: an agent that grew up in a kitchen and one that grew up in a warehouse will grow two entirely different trees.
Related attempts
Combining large models with behavior trees is not a new idea. Dendron7 puts large models inside the nodes of a behavior tree and uses the tree to organize an agent's conversation and actions, but its trees are written by people and do not change at run time; its authors leave trees that learn for future work. BETR-XP-LLM8 goes further: when a robot fails a task, a large model finds the missing precondition and adds it to the tree, so the next case of the same kind can be handled. Another line of work, Voyager9 for example, has an agent write the skills it learns as code and keep them in an ever larger skill library.
What these works accumulate is mostly what the agent can do: the steps and skills for getting tasks done. The reflex tree in this post accumulates what the agent responds to. It looks after what happens to the agent, while what the agent sets out to do stays with the model and the programs it writes. The two do not conflict; an agent can perfectly well build up its skills and grow its reflex tree at the same time.
03On free will, and some thoughts of my own
Some background
The idea of a reflex goes back to Descartes. In his Treatise of Man10 he describes what happens when someone's foot comes near a fire: particles of the fire move the skin, which pulls a fine thread running all the way up to the brain; a small pore in the brain opens, the animal spirits flow down the nerve into the muscles, and the foot draws back. No thought is involved at any point. Descartes held that animals are nothing but machines of this kind, and so is the human body. The only difference between people and animals is that people also have a soul, seated deep in the brain in the pineal gland, which takes over only when there is something to judge or choose.
About a century later, La Mettrie wrote Man a Machine11 and took away the soul that Descartes had left to people as well. The argument over whether people are machines has gone on for nearly three hundred years since, and it is still not settled.
A thought experiment
Let us run a thought experiment. Imagine an agent whose reflex tree has been growing for many years, with more nodes than anyone could count. It turns round when someone calls it, steadies the cup when the water is about to spill, and keeps away from things that have hurt it before; when something comes up that its reflex tree has no node for, it stops to think, then turns what it worked out into a new reaction, so that next time it does not have to think. Put it in a room with a person and watch only what they do. Could you tell which is the machine and which is the person?
If behavior no longer tells them apart, it seems the only way left is to open them up. Open the agent, and we find a reflex tree and a model; why each node came in at a given moment can be traced line by line. Open a human brain, and we find neurons, each firing just as bound by the laws of physics, only we cannot yet trace them in that much detail. If the difference comes down to whether we can trace things clearly, it looks more like a gap in our knowledge, and has little to do with the two things themselves.
Why we feel free
Why, then, do people feel that what they do is truly free, rather than driven by a mechanism?
Two experiments may offer a hint. The first is Libet's12, from 1983: he asked people to flex a wrist whenever they felt like it and to note the moment they decided to move. The electrical activity in the brain that prepares the movement began about a third of a second before they were aware of meaning to move. The second comes from Gazzaniga's work with split-brain patients13: one patient's left hemisphere was shown a chicken claw and the right a snowy scene, and he was asked to pick related pictures from a set. His right hand, run by the left hemisphere, pointed to a chicken; his left hand, run by the right hemisphere, pointed to a shovel. Asked why he chose the shovel, the left hemisphere, which handles speech and knew nothing of the snow, answered without hesitation: you need a shovel to clean out the chicken shed.
The two experiments say the same thing: the action often comes first, and the feeling of "I decided" and the reason arrive afterwards. More than three hundred years ago Spinoza14 said that people believe themselves free because they are aware of their actions but ignorant of the causes that determine them.
Back to that agent. Its reflex tree steadied the cup for it, and the model only heard about it afterwards. If someone asked it then why it did that, it too would give a sensible reason.
Acknowledgements
Thanks to Wenhao Chai and Weiyang Jin for the discussions behind this post.
Thanks also to everyone who built The Harness: Zilin Wang, Hui Shen, Zhengjie Xu, Weiyang Jin, Yuwei Niu, Ye Li, Jiechen Zhang, Yinpei Dai, Yunhao Luo, Wenhao Chai, Xuweiyi Chen, Ziwei Liu and Stella X. Yu.
References
- D. Silver, R. S. Sutton, “Welcome to the Era of Experience,” in Designing an Intelligence, MIT Press, 2025.
- D. Isla, “Handling Complexity in the Halo 2 AI,” Game Developers Conference, 2005.
- S. Macenski, F. Martín, R. White, J. Ginés Clavero, “The Marathon 2: A Navigation System,” IROS, 2020.
- R. A. Brooks, “A Robust Layered Control System for a Mobile Robot,” IEEE Journal of Robotics and Automation, 1986.
- R. A. Brooks, “Intelligence without Representation,” Artificial Intelligence, 1991.
- O. Biggar, M. Zamani, I. Shames, “On Modularity in Reactive Control Architectures, with an Application to Formal Verification,” ACM Transactions on Cyber-Physical Systems, 2022.
- R. Kelley, “Behavior Trees Enable Structured Programming of Language Model Agents,” arXiv, 2024.
- J. Styrud, M. Iovino, M. Norrlöf, M. Björkman, C. Smith, “Automatic Behavior Tree Expansion with LLMs for Robotic Manipulation,” ICRA, 2025.
- G. Wang, Y. Xie, Y. Jiang et al., “Voyager: An Open-Ended Embodied Agent with Large Language Models,” arXiv, 2023.
- R. Descartes, Treatise of Man (L’Homme), 1664.
- J. O. de La Mettrie, Man a Machine (L’Homme machine), 1747.
- B. Libet, C. A. Gleason, E. W. Wright, D. K. Pearl, “Time of Conscious Intention to Act in Relation to Onset of Cerebral Activity (Readiness-Potential),” Brain, 1983.
- M. S. Gazzaniga, J. E. LeDoux, The Integrated Mind, Plenum Press, 1978.
- B. Spinoza, Ethics, 1677.
Citation
@misc{lmmslab2026harness,
author = {{LMMs-Lab}},
title = {The Harness: Automatic Control for Intelligence in Action.},
howpublished = {\url{https://github.com/EvolvingLMMs-Lab/the-harness}},
year = {2026}
}