from krita import Krita
from actuator.api.utils import state
actions = [
'KritaShape/KisToolLine',
'KritaShape/KisToolRectangle',
'KritaShape/KisToolEllipse',
'KisToolPolygon',
'KisToolPolyline',
]
i = state.get("tool index", 0)
action_name = actions[min(i, len(actions) - 1)]
Krita.instance().action(action_name).trigger()
print(action_name)
i = (i + 1) % len(actions)
state["tool index"] = i

Download sequence.
Is cycling through tools is to much? Maybe you need just toggle between brushes. That is possible too.