model.system_prompt = "You are a helpful assistant."
while not done:
response = model.chat(messages)
if response.has_tool_calls:
for tool_call in response.tool_calls:
result = execute(tool_call) # ← runs locally
messages.append(result)
else:
done = true # model is finished