Behavior Tree Back Chaining
also known as Goal-Driven BT Construction, Postcondition-Driven Tree
Construct an agent's behavior tree starting from the desired goal condition and recursively adding child nodes whose post-conditions satisfy each parent's pre-conditions.
Context
A team is authoring a [[agentic-behavior-tree]] for a complex task. Authoring it forward — guess at the root, then the children, then leaves — leads to trees that look plausible but do not actually achieve the goal because pre-conditions of interior nodes are not satisfied by the children chosen.
Problem
Forward authoring confuses the question 'what tasks belong in this sub-tree' with 'do those tasks produce the conditions the parent needs'. Designers end up with trees that demo well on the happy path but fail when sub-task pre-conditions are not met. Without a construction discipline that asks 'what post-condition must hold for the parent to succeed, and what tasks produce it', trees grow as decorative tracings of the designer's intuition rather than principled goal-driven structures.
Forces
- Goal post-conditions are usually the most stable artifact in the task spec.
- Each node has a pre-condition (what must hold for it to run) and a post-condition (what it produces).
- Children must satisfy the parent's pre-condition; this constraint should drive authoring.
- Mechanical back-chaining produces broad shallow trees; manual pruning is needed.
Example
Goal: customer is onboarded. Pre-condition: account exists and welcome sent. Producers: account-setup task (needs identity verified) and welcome-send task (needs email known). Back-chain identity verified → OAuth or email-verify or escalation. Back-chain email known → OAuth, OAuth response, or ask-user. The resulting tree's leaves are exactly the starting-state-satisfiable tasks; everything in between was added because something above needed it.
Diagram
Solution
Therefore:
Author the tree from the root downward by asking, for each new node, 'what pre-conditions must hold for this to succeed, and what tasks produce those pre-conditions?'. Each task added becomes a child whose own pre-conditions trigger another round. Recurse until pre-conditions are satisfied by the starting state. Mechanical back-chaining yields broad trees; designers prune to the cases the agent will realistically encounter. The discipline ensures every node's children are there because they produce something the parent needs.
What this pattern forbids. The behavior tree must not be authored only forward by intuition; every interior node's children must be present because their post-conditions satisfy the parent's pre-conditions.
And the patterns that stand alongside it, or against it —
- complementsAgentic Behavior Tree·— Borrow the behavior-tree formalism: leaves are LLM calls or tools that return success/failure; a tree of selectors and sequences orchestrates control flow.
- alternative-toPlan-and-Execute★★— Plan all the steps once with a strong model, then execute each step with a cheaper model under the plan.
- complementsGoal Decomposition★★— Decompose a goal into sub-goals recursively until each leaf is directly actionable.
- complementsHierarchical Agents★★— Organise agents in a tree where higher-level agents decompose tasks for lower-level agents, recursively.
Neighbourhood
Click any neighbour to follow the language. Scroll to zoom, drag to pan.