The sense of agency from active causal inference