In Databricks, AI agent traces from the Mosaic AI Agent Framework or Model Serving can be exported as nested JSON logs. Write a function that parses a JSON log string and returns a normalized sequence of lowercase tokens from selected interaction fields.
The function should traverse a JSON object that may contain nested dictionaries and lists, extract string values only from these keys: user_message, agent_response, tool_name, tool_input, tool_output, retrieved_context, and model. Tokenization rules: convert to lowercase, split on any non-alphanumeric character, discard empty tokens, and preserve encounter order. Ignore all other keys and all non-string values.
def tokenize_agent_log(log_json):