You just need to give an instruction something along the lines of "any initial calculation or derived value must be computed through the use of a $LANG program."
Pretty sure the LLMs could implement tax calculations better than the average accountant, were they given the rules.
In my experience agents will reach for numpy for any non trivial math without being instructed