For a current-day LLM, deviation could be measured as the number of tokens since the agent touched on the prompted topic. A specific <<refocus>> token could even be trained so that a harness or other tooling could direct the LLM back towards the prompted topic if needed.
Or something roughly like that. Generally speaking the goal would be for the LLM to bring the topic back on its own while incorporating the tangent, but a hardcoded, "Let's get back on track" button would probably be needed
> a hardcoded, "Let's get back on track" button would probably be needed
Very true! An adult might hit that button. 4-9 year olds I think are less likely to.