Drill-down and drill-up, or automated learning by asking questions on LangGraph

Created: September 2026 Updated: Oct. 27, 2026

side project

Python, LangGraph, LangChain, modele językowe

Agents learn a topic or a ready program the way a person does: they ask, follow up and put the whole picture together from those questions.

Ask a language model about a topic and it answers with a whole lecture right away, smooth and in order, like a textbook. A person learning something does it differently: asks about one word, then for an example, then “what if”, gets lost, comes back, and only from those questions does the whole picture emerge. A study plan from the LLM doesn't help much either, because it's written from the point of view of someone who already knows it all, without the questions that really come to mind on first contact. I wanted to see whether that human way could be automated, so that learning leaves behind a tree of questions showing the order in which a topic actually makes sense.

How it works

Three roles, each on its own model, wired into a graph on LangGraph. The curator sets goals and judges when the student has reached them, the expert answers briefly, one question at a time, and after each answer the student comes up with further questions. The loop is the same in both directions, what differs is where it starts and what the student asks about:

python
def drill(start, direction):
    goals = curator.goals(start)
    queue, tree = [student.first_question(start)], []
    while queue and not curator.done(goals, tree):
        question = queue.pop(0)
        answer = expert.answer(question)
        tree.append((question, answer))
        queue += student.ask(question, answer, direction)
    return tree


path = from_basics(tree)  # the tree turned around: from the basics to the whole

A working, simplified program with drill-down alone is taken apart line by line in the article on LangChain and LangGraph.

What the student should care about

The hardest part turned out to be deciding what the student should ask about, so that its curiosity went the same way as mine. The student knows nothing by design, so it asks about everything, while for me not everything matters equally. That's where most of the iterations went, and it's the part I'm not showing here.

Drill-down: from a topic downwards

It starts with a topic and the student goes into detail. This is a piece of learning Apache Jena Fuseki:

What is Apache Jena Fuseki?
├── What do subject, predicate and object in an RDF triple mean?
│   └── Can I write several triples about one subject more briefly?
├── Can I write a Turtle file myself and check it in Python?
│   └── "ex:wiek 30" without a type, will rdflib recognise it?
└── SPARQL looks like SQL SELECT, is there INSERT and DELETE?

Drill-up: from a ready program upwards

Here it starts with a ready program, the student asks about what it sees and after the answer goes up, what it's called in general and what it's like. A piece of learning a short household budget program, with a student who has never programmed:

What is this and how am I supposed to read it?
├── What does the word class mean?
│   └── What does self mean in self.nazwa?
│       ├── How does Python tell self.nazwa from nazwa?
│       └── Where does self come from, do I pass it?
│           └── Does __init__ have to be called that?
└── What does the dot in budzet.dodaj(...) mean?

From zero to hero

The student went from the specific, while teaching has to start from the basics, so at the end the tree is turned into a path from the basics to the whole. Thanks to drill-up and questions laid out from the basics, this turned into a rather interesting, if dense as tar, article that explains the household budget program from zero, line by line, for someone who has never programmed.

Machine-translated from Polish (original).