An experimental state machine for driving workflows in an api