A Grok 4.7 agent in Python: allowlisted tools, a bounded loop, and fallback you can audit
Most "agents" I ship are a while loop with an LLM call inside. That's fine. The hard part isn't the loop, it's the policy around it: which functions the model is allowed to trigger, which failures justify trying another model, and where the loop stops.